diff options
| -rw-r--r-- | util-linux/mdev.c | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/util-linux/mdev.c b/util-linux/mdev.c index 8f2312060..c100e0fa6 100644 --- a/util-linux/mdev.c +++ b/util-linux/mdev.c | |||
| @@ -170,15 +170,13 @@ end: | |||
| 170 | static void find_dev(char *path) | 170 | static void find_dev(char *path) |
| 171 | { | 171 | { |
| 172 | DIR *dir; | 172 | DIR *dir; |
| 173 | int len=strlen(path); | 173 | size_t len=strlen(path); |
| 174 | struct dirent *entry; | ||
| 174 | 175 | ||
| 175 | if (!(dir = opendir(path))) | 176 | if ((dir = opendir(path)) == NULL) |
| 176 | bb_perror_msg_and_die("No %s",path); | 177 | return; |
| 177 | 178 | ||
| 178 | for (;;) { | 179 | while ((entry = readdir(dir)) != NULL) { |
| 179 | struct dirent *entry = readdir(dir); | ||
| 180 | |||
| 181 | if (!entry) break; | ||
| 182 | 180 | ||
| 183 | /* Skip "." and ".." (also skips hidden files, which is ok) */ | 181 | /* Skip "." and ".." (also skips hidden files, which is ok) */ |
| 184 | 182 | ||
| @@ -187,7 +185,6 @@ static void find_dev(char *path) | |||
| 187 | if (entry->d_type == DT_DIR) { | 185 | if (entry->d_type == DT_DIR) { |
| 188 | snprintf(path+len, PATH_MAX-len, "/%s", entry->d_name); | 186 | snprintf(path+len, PATH_MAX-len, "/%s", entry->d_name); |
| 189 | find_dev(path); | 187 | find_dev(path); |
| 190 | path[len] = 0; | ||
| 191 | } | 188 | } |
| 192 | 189 | ||
| 193 | /* If there's a dev entry, mknod it */ | 190 | /* If there's a dev entry, mknod it */ |
