svn commit: trunk/busybox/util-linux

vda at busybox.net vda at busybox.net
Fri Jun 8 16:18:16 UTC 2007


Author: vda
Date: 2007-06-08 09:18:15 -0700 (Fri, 08 Jun 2007)
New Revision: 18784

Log:
mdev: microscopic enhancement, should change nothing



Modified:
   trunk/busybox/util-linux/mdev.c


Changeset:
Modified: trunk/busybox/util-linux/mdev.c
===================================================================
--- trunk/busybox/util-linux/mdev.c	2007-06-08 15:41:27 UTC (rev 18783)
+++ trunk/busybox/util-linux/mdev.c	2007-06-08 16:18:15 UTC (rev 18784)
@@ -178,17 +178,15 @@
 		if (ENABLE_FEATURE_MDEV_CONF) chown(device_name, uid, gid);
 	}
 	if (command) {
-		int rc;
-		char *s;
-
-		s = xasprintf("MDEV=%s", device_name);
+		/* setenv will leak memory, so use putenv */
+		char *s = xasprintf("MDEV=%s", device_name);
 		putenv(s);
-		rc = system(command);
-		s[4] = 0;
-		putenv(s);
+		if (system(command) == -1)
+			bb_perror_msg_and_die("cannot run %s", command);
+		s[4] = '\0';
+		unsetenv(s);
 		free(s);
 		free(command);
-		if (rc == -1) bb_perror_msg_and_die("cannot run %s", command);
 	}
 	if (delete) unlink(device_name);
 }




More information about the busybox-cvs mailing list