summaryrefslogtreecommitdiff
path: root/dir.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 /dir.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 'dir.c')
-rw-r--r--dir.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/dir.c b/dir.c
index 39f3e2a..7db0697 100644
--- a/dir.c
+++ b/dir.c
@@ -455,7 +455,7 @@ find_directory (char *name)
#ifdef VMS
r = vmsstat_dir (name, &st);
#else
- r = stat (name, &st);
+ EINTRLOOP (r, stat (name, &st));
#endif
#ifdef WINDOWS32
@@ -536,7 +536,7 @@ find_directory (char *name)
# endif
#endif /* WINDOWS32 */
hash_insert_at (&directory_contents, dc, dc_slot);
- dc->dirstream = opendir (name);
+ ENULLLOOP (dc->dirstream, opendir (name));
if (dc->dirstream == 0)
/* Couldn't open the directory. Mark this by
setting the `files' member to a nil pointer. */
@@ -645,13 +645,17 @@ dir_contents_file_exists_p (struct directory_contents *dir, char *filename)
return 0;
}
- while ((d = readdir (dir->dirstream)) != 0)
+ while (1)
{
/* Enter the file in the hash table. */
unsigned int len;
struct dirfile dirfile_key;
struct dirfile **dirfile_slot;
+ ENULLLOOP (d, readdir (dir->dirstream));
+ if (d == 0)
+ break;
+
#if defined(VMS) && defined(HAVE_DIRENT_H)
/* In VMS we get file versions too, which have to be stripped off */
{
@@ -1155,7 +1159,10 @@ extern int stat PARAMS ((const char *path, struct stat *sbuf));
static int
local_stat (const char *path, struct stat *buf)
{
- return stat (path, buf);
+ int e;
+
+ EINTRLOOP (e, stat (path, buf));
+ return e;
}
#endif