+
+ /*
+ * If the file exists in one of the directories and isn't
+ * readable, continue looking. However, change the error code
+ * to give an indication that the file exists.
+ */
+ err = ENOTFOUND;
+ for (dirp = dirs; dirp->name != NULL; dirp++) {
+ sprintf(pathname, "%s/%s", dirp->name, filename);
+ if (stat(pathname, &stbuf) == 0 &&
+ (stbuf.st_mode & S_IFMT) == S_IFREG) {
+ if ((stbuf.st_mode & S_IROTH) != 0) {
+ break;
+ }
+ err = EACCESS;
+ }
+ }
+ if (dirp->name == NULL)
+ return (err);
+ *filep = filename = pathname;