DragonFly BSD
DragonFly submit List (threaded) for 2005-09
[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]

Re: [PATCH] setenv|putenv rc checking (bin)


From: joerg@xxxxxxxxxxxxxxxxx
Date: Thu, 29 Sep 2005 14:21:34 +0200
Mail-followup-to: submit@crater.dragonflybsd.org

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);



[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]