From: Todd C. Miller Date: Wed, 8 Sep 1993 15:53:08 +0000 (+0000) Subject: redid the fix for non-executable files in an easier to read way plus X-Git-Tag: SUDO_1_3_0~93 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=2ddeba57efffe3573e4263f69730c4480cbcd432;p=sudo redid the fix for non-executable files in an easier to read way plus some minor aethetic changes --- diff --git a/find_path.c b/find_path.c index ec8567916..83af6e6b8 100644 --- a/find_path.c +++ b/find_path.c @@ -100,21 +100,20 @@ char *find_path(file) } while ((n = index(path, ':'))) { - *n='\0'; - strcpy(fn, path); - strcat(fn, "/"); - strcat(fn, file); + *n = '\0'; + (void)strcpy(fn, path); + (void)strcat(fn, "/"); + (void)strcat(fn, file); /* stat the file to make sure it exists and is executable */ statfailed = stat(fn, &statbuf); if (!statfailed && (statbuf.st_mode & 0000111)) - return (qualify(fn)); - else if (!statfailed || errno == ENOENT || errno == ENOTDIR) - path=n+1; - else { + return(qualify(fn)); + else if (statfailed && errno != ENOENT && errno != ENOTDIR) { perror("find_path: stat"); exit(1); } + path = n + 1; } return(NULL); }