aboutsummaryrefslogtreecommitdiff
path: root/util-linux/mdev.c
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2009-05-04 21:59:05 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2009-05-04 21:59:05 +0200
commit76f5e38c8228664680d915873186d891e64a3c0a (patch)
treeccc971a6b55f11e3f81a5f29148689e4162ef45b /util-linux/mdev.c
parent6245202e7fc76992b838613a1c2bde79387a28c0 (diff)
downloadbusybox-w32-76f5e38c8228664680d915873186d891e64a3c0a.tar.gz
busybox-w32-76f5e38c8228664680d915873186d891e64a3c0a.tar.bz2
busybox-w32-76f5e38c8228664680d915873186d891e64a3c0a.zip
mdev: revert last wrong commit
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'util-linux/mdev.c')
-rw-r--r--util-linux/mdev.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/util-linux/mdev.c b/util-linux/mdev.c
index 99e487532..7508930f7 100644
--- a/util-linux/mdev.c
+++ b/util-linux/mdev.c
@@ -101,8 +101,12 @@ static char *build_alias(char *alias, const char *device_name)
101 return alias; 101 return alias;
102} 102}
103 103
104/* mknod in /dev based on a path like "/sys/block/hda/hda1" */ 104/* mknod in /dev based on a path like "/sys/block/hda/hda1"
105/* NB: "mdev -s" may call us many times, do not leak memory/fds! */ 105 * NB1: path parameter needs to have SCRATCH_SIZE scratch bytes
106 * after NUL, but we promise to not mangle (IOW: to restore if needed)
107 * path string.
108 * NB2: "mdev -s" may call us many times, do not leak memory/fds!
109 */
106static void make_device(char *path, int delete) 110static void make_device(char *path, int delete)
107{ 111{
108 char *device_name; 112 char *device_name;
@@ -565,10 +569,7 @@ int mdev_main(int argc UNUSED_PARAM, char **argv)
565 make_device(temp, 1); 569 make_device(temp, 1);
566 } 570 }
567 else if (strcmp(action, "add") == 0) { 571 else if (strcmp(action, "add") == 0) {
568 /* make_device mangles its parameter, use a copy */ 572 make_device(temp, 0);
569 char *s = xstrdup(temp);
570 make_device(s, 0);
571 free(s);
572 if (ENABLE_FEATURE_MDEV_LOAD_FIRMWARE) { 573 if (ENABLE_FEATURE_MDEV_LOAD_FIRMWARE) {
573 if (fw) 574 if (fw)
574 load_firmware(fw, temp); 575 load_firmware(fw, temp);