summaryrefslogtreecommitdiff
path: root/util-linux
diff options
context:
space:
mode:
authorMike Frysinger2008-02-20 18:31:36 +0000
committerMike Frysinger2008-02-20 18:31:36 +0000
commitae86a338b89c1339588226cb2298e1785aaa7b90 (patch)
tree93ef8f5d623086fef1c5038939c7f8859158b26a /util-linux
parent597906c436f57d96deec5c57e5ba50bf3a95a5b7 (diff)
downloadbusybox-ae86a338b89c1339588226cb2298e1785aaa7b90.zip
busybox-ae86a338b89c1339588226cb2298e1785aaa7b90.tar.gz
[#1334] exec script for devices even if they dont have device nodes
Diffstat (limited to 'util-linux')
-rw-r--r--util-linux/mdev.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/util-linux/mdev.c b/util-linux/mdev.c
index 2bb0224..9c33feb 100644
--- a/util-linux/mdev.c
+++ b/util-linux/mdev.c
@@ -45,8 +45,13 @@ static void make_device(char *path, int delete)
strcat(path, "/dev");
len = open_read_close(path, temp + 1, 64);
*temp++ = 0;
- if (len < 1)
- return;
+ if (len < 1) {
+ if (ENABLE_FEATURE_MDEV_EXEC)
+ /* no "dev" file, so just try to run script */
+ *temp = 0;
+ else
+ return;
+ }
}
/* Determine device name, type, major and minor */
@@ -181,8 +186,12 @@ static void make_device(char *path, int delete)
}
if (!delete) {
- if (sscanf(temp, "%d:%d", &major, &minor) != 2)
- return;
+ if (sscanf(temp, "%d:%d", &major, &minor) != 2) {
+ if (ENABLE_FEATURE_MDEV_EXEC)
+ goto skip_creation;
+ else
+ return;
+ }
if (ENABLE_FEATURE_MDEV_RENAME)
unlink(device_name);
@@ -217,6 +226,7 @@ static void make_device(char *path, int delete)
free(dest);
}
}
+ skip_creation: /* nothing */ ;
}
if (ENABLE_FEATURE_MDEV_EXEC && command) {
/* setenv will leak memory, so use putenv */