aboutsummaryrefslogtreecommitdiffstats
path: root/src/fldd/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/fldd/main.c')
-rw-r--r--src/fldd/main.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/fldd/main.c b/src/fldd/main.c
index 9d91557c1..b71145793 100644
--- a/src/fldd/main.c
+++ b/src/fldd/main.c
@@ -261,12 +261,21 @@ static void walk_directory(const char *dirname) {
261 261
262 // check directory 262 // check directory
263 // entry->d_type field is supported in glibc since version 2.19 (Feb 2014) 263 // entry->d_type field is supported in glibc since version 2.19 (Feb 2014)
264 // we'll use stat to check for directories 264 // we'll use stat to check for directories using the real path
265 // (sometimes the path is a double symlink to a real file and stat would fail)
266 char *rpath = realpath(path, NULL);
267 if (!rpath) {
268 free(path);
269 continue;
270 }
271 free(path);
272
265 struct stat s; 273 struct stat s;
266 if (stat(path, &s) == -1) 274 if (stat(rpath, &s) == -1)
267 errExit("stat"); 275 errExit("stat");
268 if (S_ISDIR(s.st_mode)) 276 if (S_ISDIR(s.st_mode))
269 walk_directory(path); 277 walk_directory(rpath);
278 free(rpath);
270 } 279 }
271 closedir(dir); 280 closedir(dir);
272 } 281 }