mdev: microscopic enhancement, should change nothing

This commit is contained in:
Denis Vlasenko 2007-06-08 16:18:15 +00:00
parent 9acfed2d14
commit d6766c71a9

View File

@ -178,17 +178,15 @@ static void make_device(char *path, int delete)
if (ENABLE_FEATURE_MDEV_CONF) chown(device_name, uid, gid); if (ENABLE_FEATURE_MDEV_CONF) chown(device_name, uid, gid);
} }
if (command) { if (command) {
int rc; /* setenv will leak memory, so use putenv */
char *s; char *s = xasprintf("MDEV=%s", device_name);
s = xasprintf("MDEV=%s", device_name);
putenv(s);
rc = system(command);
s[4] = 0;
putenv(s); putenv(s);
if (system(command) == -1)
bb_perror_msg_and_die("cannot run %s", command);
s[4] = '\0';
unsetenv(s);
free(s); free(s);
free(command); free(command);
if (rc == -1) bb_perror_msg_and_die("cannot run %s", command);
} }
if (delete) unlink(device_name); if (delete) unlink(device_name);
} }