[PATCH] setenv|putenv rc checking (bin)

joerg at britannica.bec.de joerg at britannica.bec.de
Thu Sep 29 05:24:17 PDT 2005


On Thu, Sep 29, 2005 at 03:42:05PM +0400, Alexey Slynko wrote:
> Index: date/date.c
> ===================================================================
> RCS file: /mnt/share/dragonfly-cvs/src/bin/date/date.c,v
> retrieving revision 1.13
> diff -u -r1.13 date.c
> --- date/date.c	20 Jul 2005 19:51:56 -0000	1.13
> +++ date/date.c	29 Sep 2005 01:01:48 -0000
> @@ -41,6 +41,7 @@
>  
>  #include <ctype.h>
>  #include <err.h>
> +#include <errno.h>
>  #include <langinfo.h>
>  #include <stdio.h>
>  #include <stdlib.h>
> @@ -117,7 +118,8 @@
>  			set_timezone = 1;
>  			break;
>  		case 'u':		/* do everything in UTC */
> -			setenv("TZ", "UTC0", 1);
> +			if (setenv("TZ", "UTC0", 1) == ENOMEM)
> +				err(1, "setenv: cannot set TZ=UTC0");

if (setenv(...) == -1)
	...

I think?

Joerg

>  			break;
>  		case 'v':
>  			v = vary_append(v, optarg);





More information about the Submit mailing list