svn commit: trunk/busybox/util-linux
vapier at busybox.net
vapier at busybox.net
Fri Feb 3 00:19:43 UTC 2006
Author: vapier
Date: 2006-02-02 16:19:42 -0800 (Thu, 02 Feb 2006)
New Revision: 13801
Log:
shrink the code a bit
Modified:
trunk/busybox/util-linux/mdev.c
Changeset:
Modified: trunk/busybox/util-linux/mdev.c
===================================================================
--- trunk/busybox/util-linux/mdev.c 2006-02-03 00:16:53 UTC (rev 13800)
+++ trunk/busybox/util-linux/mdev.c 2006-02-03 00:19:42 UTC (rev 13801)
@@ -170,16 +170,14 @@
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);
+ while ((entry = readdir(dir)) != NULL) {
- if (!entry) break;
-
/* Skip "." and ".." (also skips hidden files, which is ok) */
if (entry->d_name[0]=='.') continue;
@@ -187,7 +185,6 @@
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 */
More information about the busybox-cvs
mailing list