summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenis Vlasenko2007-06-08 16:18:15 +0000
committerDenis Vlasenko2007-06-08 16:18:15 +0000
commitd6766c71a95b35ef12b9adbec9d32b0ca91fba74 (patch)
tree6e64125dfdb4a87898e0edfe7a630f0069b1d165
parent9acfed2d14cb8b2310fd3bb56ceed589a9348912 (diff)
downloadbusybox-d6766c71a95b35ef12b9adbec9d32b0ca91fba74.zip
busybox-d6766c71a95b35ef12b9adbec9d32b0ca91fba74.tar.gz
mdev: microscopic enhancement, should change nothing
-rw-r--r--util-linux/mdev.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/util-linux/mdev.c b/util-linux/mdev.c
index cc729e7..d1b2684 100644
--- a/util-linux/mdev.c
+++ b/util-linux/mdev.c
@@ -178,17 +178,15 @@ static void make_device(char *path, int delete)
if (ENABLE_FEATURE_MDEV_CONF) chown(device_name, uid, gid);
}
if (command) {
- int rc;
- char *s;
-
- s = xasprintf("MDEV=%s", device_name);
- putenv(s);
- rc = system(command);
- s[4] = 0;
+ /* setenv will leak memory, so use putenv */
+ char *s = xasprintf("MDEV=%s", device_name);
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);
}