From d33ff301454fa1db9919674dbc2a37309bbd529f Mon Sep 17 00:00:00 2001 From: Paul Smith Date: Thu, 30 Jan 2003 05:22:52 +0000 Subject: 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). --- dir.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'dir.c') 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 -- cgit v1.2.3