diff options
author | Mike Frysinger <vapier@gentoo.org> | 2006-02-03 00:19:42 +0000 |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2006-02-03 00:19:42 +0000 |
commit | 248d2220f9985754268f4492278758052494b80a (patch) | |
tree | dd7905944e1b1041c1cc60445905bc797238efca /util-linux | |
parent | 53d57dbe6bf54f4a44989e02afc9176d3ce5365f (diff) | |
download | busybox-248d2220f9985754268f4492278758052494b80a.tar.gz |
shrink the code a bit
Diffstat (limited to 'util-linux')
-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: static void find_dev(char *path) { DIR *dir; - int len=strlen(path); + size_t len=strlen(path); + struct dirent *entry; - if (!(dir = opendir(path))) - bb_perror_msg_and_die("No %s",path); + if ((dir = opendir(path)) == NULL) + return; - for (;;) { - struct dirent *entry = readdir(dir); - - if (!entry) break; + while ((entry = readdir(dir)) != NULL) { /* Skip "." and ".." (also skips hidden files, which is ok) */ @@ -187,7 +185,6 @@ static void find_dev(char *path) if (entry->d_type == DT_DIR) { snprintf(path+len, PATH_MAX-len, "/%s", entry->d_name); find_dev(path); - path[len] = 0; } /* If there's a dev entry, mknod it */ |