summaryrefslogtreecommitdiff
path: root/vpath.c
diff options
context:
space:
mode:
Diffstat (limited to 'vpath.c')
-rw-r--r--vpath.c46
1 files changed, 26 insertions, 20 deletions
diff --git a/vpath.c b/vpath.c
index 18aaaa9..5e04d08 100644
--- a/vpath.c
+++ b/vpath.c
@@ -507,27 +507,33 @@ selective_vpath_search (struct vpath *path, char **file,
*n = '/';
#endif
- if (!exists_in_cache /* Makefile-mentioned file need not exist. */
- || stat (name, &st) == 0) /* Does it really exist? */
+ if (exists_in_cache) /* Makefile-mentioned file need not exist. */
{
- /* We have found a file.
- Store the name we found into *FILE for the caller. */
-
- *file = savestring (name, (n + 1 - name) + flen);
-
- if (mtime_ptr != 0)
- /* Store the modtime into *MTIME_PTR for the caller.
- If we have had no need to stat the file here,
- we record UNKNOWN_MTIME to indicate this. */
- *mtime_ptr = (exists_in_cache
- ? FILE_TIMESTAMP_STAT_MODTIME (name, st)
- : UNKNOWN_MTIME);
-
- free (name);
- return 1;
- }
- else
- exists = 0;
+ int e;
+
+ EINTRLOOP (e, stat (name, &st)); /* Does it really exist? */
+ if (e != 0)
+ {
+ exists = 0;
+ continue;
+ }
+ }
+
+ /* We have found a file.
+ Store the name we found into *FILE for the caller. */
+
+ *file = savestring (name, (n + 1 - name) + flen);
+
+ if (mtime_ptr != 0)
+ /* Store the modtime into *MTIME_PTR for the caller.
+ If we have had no need to stat the file here,
+ we record UNKNOWN_MTIME to indicate this. */
+ *mtime_ptr = (exists_in_cache
+ ? FILE_TIMESTAMP_STAT_MODTIME (name, st)
+ : UNKNOWN_MTIME);
+
+ free (name);
+ return 1;
}
}