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

[PATCH] corrected setenv|putenv rc checking (bin)


From: Alexey Slynko <slynko@xxxxxxxxx>
Date: Fri, 30 Sep 2005 13:12:24 +0400

Hi,

it's corrected veriosn of previous patch
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
@@ -117,7 +118,8 @@
 			set_timezone = 1;
 			break;
 		case 'u':		/* do everything in UTC */
-			setenv("TZ", "UTC0", 1);
+			if (setenv("TZ", "UTC0", 1) != 0)
+				err(1, "setenv: cannot set TZ=UTC0");
 			break;
 		case 'v':
 			v = vary_append(v, optarg);
Index: df/df.c
===================================================================
RCS file: /mnt/share/dragonfly-cvs/src/bin/df/df.c,v
retrieving revision 1.5
diff -u -r1.5 df.c
--- df/df.c	7 Nov 2004 20:54:51 -0000	1.5
+++ df/df.c	29 Sep 2005 00:55:17 -0000
@@ -144,11 +144,13 @@
 		case 'b':
 				/* FALLTHROUGH */
 		case 'P':
-			putenv("BLOCKSIZE=512");
+			if (putenv("BLOCKSIZE=512") != 0)
+				err(1, "putenv: cannot set BLOCKSIZE=512");
 			hflag = 0;
 			break;
 		case 'g':
-			putenv("BLOCKSIZE=1g");
+			if (putenv("BLOCKSIZE=1g") != 0)
+				err(1, "putenv: cannot set BLOCKSIZE=1g");
 			hflag = 0;
 			break;
 		case 'H':
@@ -163,7 +165,8 @@
 			iflag = 1;
 			break;
 		case 'k':
-			putenv("BLOCKSIZE=1k");
+			if (putenv("BLOCKSIZE=1k") != 0)
+				err(1, "putenv: cannot set BLOCKSIZE=1k");
 			hflag = 0;
 			break;
 		case 'l':
@@ -172,7 +175,8 @@
 			vfslist = makevfslist(makenetvfslist());
 			break;
 		case 'm':
-			putenv("BLOCKSIZE=1m");
+			if (putenv("BLOCKSIZE=1m") != 0)
+				err(1, "putenv: cannot set BLOCKSIZE=1m");
 			hflag = 0;
 			break;
 		case 'n':
Index: ls/ls.c
===================================================================
RCS file: /mnt/share/dragonfly-cvs/src/bin/ls/ls.c,v
retrieving revision 1.14
diff -u -r1.14 ls.c
--- ls/ls.c	18 Sep 2005 18:01:49 -0000	1.14
+++ ls/ls.c	29 Sep 2005 00:48:06 -0000
@@ -221,7 +221,8 @@
 			fts_options |= FTS_COMFOLLOW;
 			break;
 		case 'G':
-			setenv("CLICOLOR", "", 1);
+			if (setenv("CLICOLOR", "", 1) != 0)
+				err(1, "setenv: cannot set CLICOLOR");
 			break;
 		case 'L':
 			fts_options &= ~FTS_PHYSICAL;
Index: sh/var.c
===================================================================
RCS file: /mnt/share/dragonfly-cvs/src/bin/sh/var.c,v
retrieving revision 1.8
diff -u -r1.8 var.c
--- sh/var.c	19 Apr 2005 05:18:19 -0000	1.8
+++ sh/var.c	29 Sep 2005 01:02:35 -0000
@@ -316,7 +317,8 @@
 			if (vp == &vmpath || (vp == &vmail && ! mpathset()))
 				chkmail(1);
 			if ((vp->flags & VEXPORT) && localevar(s)) {
-				putenv(s);
+				if (putenv(s) != 0)
+					err(1, "putenv: cannot set %s", s);
 				setlocale(LC_ALL, "");
 			}
 			INTON;
@@ -332,7 +334,8 @@
 	INTOFF;
 	*vpp = vp;
 	if ((vp->flags & VEXPORT) && localevar(s)) {
-		putenv(s);
+		if (putenv(s) != 0)
+			err(1, "putenv: cannot set %s", s);
 		setlocale(LC_ALL, "");
 	}
 	INTON;
@@ -553,7 +556,8 @@
 
 						vp->flags |= flag;
 						if ((vp->flags & VEXPORT) && localevar(vp->text)) {
-							putenv(vp->text);
+							if (putenv(vp->text) != 0)
+								err(1, "putenv: cannot set %s", vp->text);
 							setlocale(LC_ALL, "");
 						}
 						goto found;


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