Work around a persistent uClibc bug, since 0.9.29 still hasn't shipped.
authorRob Landley <rob@landley.net>
Tue, 13 Jun 2006 18:27:16 +0000 (18:27 -0000)
committerRob Landley <rob@landley.net>
Tue, 13 Jun 2006 18:27:16 +0000 (18:27 -0000)
Poked to do this by Jason Schoon.

util-linux/mdev.c

index d0c40e2ae0b241b0148eb04289aac6740aafe019..73a82314c3cf3ef572ffcdf7b697898c83c2c06f 100644 (file)
@@ -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 */