From: Jens Axboe Date: Mon, 17 Jul 2006 16:15:41 +0000 (+0200) Subject: [PATCH] Use lstat() instead of stat() in sysfs lookup X-Git-Tag: fio-1.6~4 X-Git-Url: https://git.kernel.dk/?p=fio.git;a=commitdiff_plain;h=3307d653f9cfc05b9c02e4cda91e6b45444dc1b0 [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. --- 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; }