diff options
-rw-r--r-- | util-linux/mdev.c | 18 |
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 */ |