]> granicus.if.org Git - sudo/commitdiff
now return NULL instead pf\b\bof exiting for nopn\b\bn-fatal errors
authorTodd C. Miller <Todd.Miller@courtesan.com>
Sat, 23 Oct 1993 00:46:05 +0000 (00:46 +0000)
committerTodd C. Miller <Todd.Miller@courtesan.com>
Sat, 23 Oct 1993 00:46:05 +0000 (00:46 +0000)
find_path.c

index 933bf8a60c1ae2055987f9d40422bb22ac482c89..ec8a4e6e22739a9961b9f803a5d1f923a0ab20ce 100644 (file)
@@ -129,10 +129,9 @@ char *find_path(file)
        if (!statfailed && (statbuf.st_mode & 0000111))
            return (qualify(fn));
        else if (statfailed && errno != ENOENT && errno != ENOTDIR &&
-                errno != EINVAL) {
+                errno != EINVAL)
            perror("find_path:  stat");
-           exit(1);
-       }
+
        path = n + 1;
 
     } while (n);
@@ -149,9 +148,10 @@ char *find_path(file)
        statfailed = stat(fn, &statbuf);
        if (!statfailed && (statbuf.st_mode & 0000111))
            return (qualify(fn));
-       else if (statfailed && errno != ENOENT && errno != ENOTDIR) {
+       else if (statfailed && errno != ENOENT && errno != ENOTDIR &&
+                errno != EINVAL) {
            perror("find_path:  stat");
-           exit(1);
+           return (NULL);
        }
     }
     return (NULL);
@@ -180,12 +180,9 @@ char *qualify(n)
      * is it a bogus path?
      */
     if (stat(n, &statbuf)) {
-       if (errno == ENOENT)
-           return (NULL);
-       else {
+       if (errno != ENOENT)
            perror("qualify:  stat");
-           exit(1);
-       }
+       return (NULL);
     }
 
     /*
@@ -240,7 +237,7 @@ char *qualify(n)
         */
        if (lstat(full, &statbuf)) {
            perror("qualify:  lstat");
-           exit(1);
+           return (NULL);
        }
 
        if ((statbuf.st_mode & S_IFMT) == S_IFLNK) {