]> granicus.if.org Git - sudo/commitdiff
now set errno to EACCES if not a regular file or not executable
authorTodd C. Miller <Todd.Miller@courtesan.com>
Fri, 1 Sep 1995 04:05:55 +0000 (04:05 +0000)
committerTodd C. Miller <Todd.Miller@courtesan.com>
Fri, 1 Sep 1995 04:05:55 +0000 (04:05 +0000)
goodpath.c

index b8d11532783b210eec3a9ec50fb8b12190d9601f..12eaacb02a9e833a92a9ebb99807a45f3f185353 100644 (file)
@@ -84,9 +84,16 @@ char * sudo_goodpath(path)
     /* discard root perms */
     set_perms(PERM_USER);
 
+    /* stat(3) failed */
+    if (!err)
+       return(NULL);
+
     /* make sure path describes an executable regular file */
-    if (!err && S_ISREG(statbuf.st_mode) &&(statbuf.st_mode & 0000111))
+    if (S_ISREG(statbuf.st_mode) && (statbuf.st_mode & 0000111)) {
        return((char *)path);
-    else
+    } else {
+       /* file is not executable/regular */
+       errno = EACCES;
        return(NULL);
+    }
 }