[PATCH] loader: actually stat something that has some chance of existing.

Dave Airlie airlied at redhat.com
Mon Oct 12 16:44:27 PDT 2009


This has been broken for 3 years and nobody noticed but I'm not sure
what the real answer is so I'm fixing it so my strace don't look so
crap.

Signed-off-by: Dave Airlie <airlied at redhat.com>
---
 hw/xfree86/loader/loadmod.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/hw/xfree86/loader/loadmod.c b/hw/xfree86/loader/loadmod.c
index 0b220f1..6c4199a 100644
--- a/hw/xfree86/loader/loadmod.c
+++ b/hw/xfree86/loader/loadmod.c
@@ -399,8 +399,8 @@ FindModuleInSubdir(const char *dirpath, const char *module)
     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;
-- 
1.6.5.rc2



More information about the xorg-devel mailing list