aboutsummaryrefslogtreecommitdiff
path: root/util-linux/mdev.c
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2008-02-20 18:31:36 +0000
committerMike Frysinger <vapier@gentoo.org>2008-02-20 18:31:36 +0000
commitae86a338b89c1339588226cb2298e1785aaa7b90 (patch)
tree93ef8f5d623086fef1c5038939c7f8859158b26a /util-linux/mdev.c
parent597906c436f57d96deec5c57e5ba50bf3a95a5b7 (diff)
downloadbusybox-w32-ae86a338b89c1339588226cb2298e1785aaa7b90.tar.gz
busybox-w32-ae86a338b89c1339588226cb2298e1785aaa7b90.tar.bz2
busybox-w32-ae86a338b89c1339588226cb2298e1785aaa7b90.zip
[#1334] exec script for devices even if they dont have device nodes
Diffstat (limited to 'util-linux/mdev.c')
-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 2bb022476..9c33feb35 100644
--- a/util-linux/mdev.c
+++ b/util-linux/mdev.c
@@ -45,8 +45,13 @@ static void make_device(char *path, int delete)
45 strcat(path, "/dev"); 45 strcat(path, "/dev");
46 len = open_read_close(path, temp + 1, 64); 46 len = open_read_close(path, temp + 1, 64);
47 *temp++ = 0; 47 *temp++ = 0;
48 if (len < 1) 48 if (len < 1) {
49 return; 49 if (ENABLE_FEATURE_MDEV_EXEC)
50 /* no "dev" file, so just try to run script */
51 *temp = 0;
52 else
53 return;
54 }
50 } 55 }
51 56
52 /* Determine device name, type, major and minor */ 57 /* Determine device name, type, major and minor */
@@ -181,8 +186,12 @@ static void make_device(char *path, int delete)
181 } 186 }
182 187
183 if (!delete) { 188 if (!delete) {
184 if (sscanf(temp, "%d:%d", &major, &minor) != 2) 189 if (sscanf(temp, "%d:%d", &major, &minor) != 2) {
185 return; 190 if (ENABLE_FEATURE_MDEV_EXEC)
191 goto skip_creation;
192 else
193 return;
194 }
186 195
187 if (ENABLE_FEATURE_MDEV_RENAME) 196 if (ENABLE_FEATURE_MDEV_RENAME)
188 unlink(device_name); 197 unlink(device_name);
@@ -217,6 +226,7 @@ static void make_device(char *path, int delete)
217 free(dest); 226 free(dest);
218 } 227 }
219 } 228 }
229 skip_creation: /* nothing */ ;
220 } 230 }
221 if (ENABLE_FEATURE_MDEV_EXEC && command) { 231 if (ENABLE_FEATURE_MDEV_EXEC && command) {
222 /* setenv will leak memory, so use putenv */ 232 /* setenv will leak memory, so use putenv */