[PATCH] Use lstat() instead of stat() in sysfs lookup
authorJens Axboe <axboe@suse.de>
Mon, 17 Jul 2006 16:15:41 +0000 (18:15 +0200)
committerJens Axboe <axboe@suse.de>
Mon, 17 Jul 2006 16:15:41 +0000 (18:15 +0200)
Otherwise we cannot detect the symlinks, and the directory
lookup will get into an infinite loop.

stat.c

diff --git a/stat.c b/stat.c
index 4cc3b7e92fbe802d80cc10f5baee9d4babfb0dee..7f38d96da7093d90c1af1eac5d51d0b3b6777bfa 100644 (file)
--- a/stat.c
+++ b/stat.c
@@ -156,8 +156,6 @@ static int find_block_dir(dev_t dev, char *path)
 
                if (!strcmp(dir->d_name, ".") || !strcmp(dir->d_name, ".."))
                        continue;
 
                if (!strcmp(dir->d_name, ".") || !strcmp(dir->d_name, ".."))
                        continue;
-               if (!strcmp(dir->d_name, "device"))
-                       continue;
 
                sprintf(full_path, "%s/%s", path, dir->d_name);
 
 
                sprintf(full_path, "%s/%s", path, dir->d_name);
 
@@ -168,7 +166,7 @@ static int find_block_dir(dev_t dev, char *path)
                        }
                }
 
                        }
                }
 
-               if (stat(full_path, &st) == -1) {
+               if (lstat(full_path, &st) == -1) {
                        perror("stat");
                        break;
                }
                        perror("stat");
                        break;
                }