From 3307d653f9cfc05b9c02e4cda91e6b45444dc1b0 Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Mon, 17 Jul 2006 18:15:41 +0200 Subject: [PATCH] [PATCH] Use lstat() instead of stat() in sysfs lookup Otherwise we cannot detect the symlinks, and the directory lookup will get into an infinite loop. --- stat.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/stat.c b/stat.c index 4cc3b7e9..7f38d96d 100644 --- 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, "device")) - continue; 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; } -- 2.25.1