summaryrefslogtreecommitdiff
path: root/vpath.c
diff options
context:
space:
mode:
authorPaul Smith <psmith@gnu.org>2003-01-30 05:22:52 +0000
committerPaul Smith <psmith@gnu.org>2003-01-30 05:22:52 +0000
commitd33ff301454fa1db9919674dbc2a37309bbd529f (patch)
treeb843b352a445c03c8d1f4c2265334ea0e83de046 /vpath.c
parentd15a484098a52e0784933ba03a98445fdc86ea3f (diff)
downloadgunmake-d33ff301454fa1db9919674dbc2a37309bbd529f.tar.gz
Portability fix for glob.h building in FreeBSD ports system.
Implement a fix for bug # 2169: too many OSs, even major OSs like Solaris, don't properly implement SA_RESTART: important system calls like stat() can still fail when SA_RESTART is set. So, forget the BROKEN_RESTART config check and get rid of atomic_stat() and atomic_readdir(), and implement permanent wrappers for EINTR checking on various system calls (stat(), fstat(), opendir(), and readdir() so far).
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;
}
}