diff --git a/hw/xfree86/loader/loadmod.c b/hw/xfree86/loader/loadmod.c index 12f5dc9..c84529f 100644 --- a/hw/xfree86/loader/loadmod.c +++ b/hw/xfree86/loader/loadmod.c @@ -408,8 +408,8 @@ FindModuleInSubdir(const char *dirpath, while ((direntry = readdir(dir))) { if (direntry->d_name[0] == '.') continue; - if ((stat(direntry->d_name, &stat_buf) == 0) && S_ISDIR(stat_buf.st_mode)) { - snprintf(tmpBuf, PATH_MAX, "%s/%s", dirpath, direntry->d_name); + snprintf(tmpBuf, PATH_MAX, "%s/%s", dirpath, direntry->d_name); + if ((stat(tmpBuf, &stat_buf) == 0) && S_ISDIR(stat_buf.st_mode)) { if ((ret = FindModuleInSubdir(tmpBuf, module))) break; continue;