From 4440efc5d227000eb0d842394fff10bf7fb98236 Mon Sep 17 00:00:00 2001 From: Stef Walter Date: Sat, 9 Dec 2006 02:40:08 +0000 Subject: - Fix bug where config files are not enumerated on reiserfs [benj] --- common/config-parser.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'common/config-parser.c') diff --git a/common/config-parser.c b/common/config-parser.c index c8f2155..c59d071 100644 --- a/common/config-parser.c +++ b/common/config-parser.c @@ -41,6 +41,7 @@ #include #include #include +#include #include #include @@ -242,6 +243,7 @@ parse_dir_internal(const char* subdir, void* data) { char path[MAXPATHLEN]; struct dirent* dire; + struct stat buf; char* memory; DIR* dir; int r; @@ -267,6 +269,23 @@ parse_dir_internal(const char* subdir, void* data) else strlcpy(path, dire->d_name, MAXPATHLEN); + /* for non BSD compliant filesystem: stat() only if dirent->d_type is unknown */ + if(dire->d_type == DT_UNKNOWN) + { + if(stat(path, &buf) < 0) + { + errmsg(NULL, data, "couldn't stat directory: %s", path); + return -1; + } + + if(S_ISREG(buf.st_mode)) + dire->d_type = DT_REG; + else if(S_ISDIR(buf.st_mode)) + dire->d_type = DT_DIR; + else + continue; + } + /* Descend into each sub directory */ if(dire->d_type == DT_DIR) { -- cgit v1.2.3