stat() can give an error, handle that
authorDana Jansens <danakj@orodu.net>
Fri, 16 Apr 2010 15:41:13 +0000 (11:41 -0400)
committerMikael Magnusson <mikachu@gmail.com>
Fri, 16 Apr 2010 18:56:24 +0000 (20:56 +0200)
obt/paths.c

index e2e4859..8afe4f7 100644 (file)
@@ -331,7 +331,8 @@ static inline gboolean try_exec(const ObtPaths *const p,
     struct stat st;
     BSEARCH_SETUP(guint);
 
     struct stat st;
     BSEARCH_SETUP(guint);
 
-    stat(path, &st);
+    if (stat(path, &st) != 0)
+        return FALSE;
 
     if (!S_ISREG(st.st_mode))
         return FALSE;
 
     if (!S_ISREG(st.st_mode))
         return FALSE;