aboutsummaryrefslogtreecommitdiff
path: root/util-linux/mdev.c
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2006-02-03 00:19:42 +0000
committerMike Frysinger <vapier@gentoo.org>2006-02-03 00:19:42 +0000
commit248d2220f9985754268f4492278758052494b80a (patch)
treedd7905944e1b1041c1cc60445905bc797238efca /util-linux/mdev.c
parent53d57dbe6bf54f4a44989e02afc9176d3ce5365f (diff)
downloadbusybox-w32-248d2220f9985754268f4492278758052494b80a.tar.gz
busybox-w32-248d2220f9985754268f4492278758052494b80a.tar.bz2
busybox-w32-248d2220f9985754268f4492278758052494b80a.zip
shrink the code a bit
Diffstat (limited to 'util-linux/mdev.c')
-rw-r--r--util-linux/mdev.c13
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:
170static void find_dev(char *path) 170static 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 */