From: Todd C. Miller Date: Fri, 1 Sep 1995 04:05:55 +0000 (+0000) Subject: now set errno to EACCES if not a regular file or not executable X-Git-Tag: SUDO_1_4_0~202 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=3cf3a02c9a4f2f550522de70a6ae648c309afb36;p=sudo now set errno to EACCES if not a regular file or not executable --- diff --git a/goodpath.c b/goodpath.c index b8d115327..12eaacb02 100644 --- a/goodpath.c +++ b/goodpath.c @@ -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); + } }