summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRob Landley2006-06-13 18:27:16 +0000
committerRob Landley2006-06-13 18:27:16 +0000
commit0960ca7383b3ef35433c269709d12fa6508cc78a (patch)
treef365f2cd800b58714c7420f41b23c2cb3067686e
parent19a3940f15d60af7781fc294eae123c64e88ae71 (diff)
downloadbusybox-0960ca7383b3ef35433c269709d12fa6508cc78a.zip
busybox-0960ca7383b3ef35433c269709d12fa6508cc78a.tar.gz
Work around a persistent uClibc bug, since 0.9.29 still hasn't shipped.
Poked to do this by Jason Schoon.
-rw-r--r--util-linux/mdev.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/util-linux/mdev.c b/util-linux/mdev.c
index d0c40e2..73a8231 100644
--- a/util-linux/mdev.c
+++ b/util-linux/mdev.c
@@ -197,17 +197,18 @@ static void find_dev(char *path)
return;
while ((entry = readdir(dir)) != NULL) {
+ struct stat st;
/* Skip "." and ".." (also skips hidden files, which is ok) */
if (entry->d_name[0] == '.')
continue;
- if (entry->d_type == DT_DIR) {
- snprintf(path+len, PATH_MAX-len, "/%s", entry->d_name);
- find_dev(path);
- path[len] = 0;
- }
+ // uClibc doesn't fill out entry->d_type reliably. so we use lstat().
+
+ snprintf(path+len, PATH_MAX-len, "/%s", entry->d_name);
+ if (!lstat(path, &st) && S_ISDIR(st.st_mode)) find_dev(path);
+ path[len] = 0;
/* If there's a dev entry, mknod it */