[PATCH] setenv|putenv rc checking (bin)

Alexey Slynko slynko at tronet.ru
Thu Sep 29 10:38:02 PDT 2005


joerg at xxxxxxxxxxxxxxxxx пишет:
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?
Yes, you right. I'll try to make and submit patches not late at night.





More information about the Submit mailing list