diff -u commands.c gcommands.c --- commands.c Tue Jun 13 10:24:43 2000 +++ gcommands.c Thu Mar 8 14:38:08 2001 @@ -493,7 +493,7 @@ } #endif - if (stat (file->name, &st) == 0 + if (atomic_stat (file->name, &st) == 0 && S_ISREG (st.st_mode) && FILE_TIMESTAMP_STAT_MODTIME (file->name, st) != file->last_mtime) { diff -u dir.c gdir.c --- dir.c Mon May 8 14:26:00 2000 +++ gdir.c Fri Mar 9 13:21:10 2001 @@ -344,8 +350,8 @@ #ifdef VMS r = vmsstat_dir (name, &st); #else - r = stat (name, &st); + r = atomic_stat (name, &st); #endif #ifdef WINDOWS32 /* Put back the trailing '\'. If we don't, we're permanently @@ -540,7 +561,7 @@ */ if (dir->path_key && (dir->fs_flags & FS_FAT || - (stat(dir->path_key, &st) == 0 && + (atomic_stat(dir->path_key, &st) == 0 && st.st_mtime > dir->mtime))) { /* reset date stamp to show most recent re-process */ @@ -1106,7 +1141,7 @@ char *path; struct stat *buf; { - return stat (path, buf); + return atomic_stat (path, buf); } #endif diff -u make.h gmake.h --- make.h Thu Jun 15 01:25:37 2000 +++ gmake.h Thu Mar 8 14:37:25 2001 @@ -466,6 +466,8 @@ extern void make_access PARAMS ((void)); extern void child_access PARAMS ((void)); +extern int atomic_stat (const char *, struct stat *); + #ifdef HAVE_VFORK_H # include #endif diff -u misc.c gmisc.c --- misc.c Tue Jun 20 10:00:17 2000 +++ gmisc.c Thu Mar 8 17:54:27 2001 @@ -857,3 +857,16 @@ return value; } #endif + +int +atomic_stat (file_name, buf) +const char *file_name; +struct stat *buf; +{ + +if (strstr(file_name, "buyer")) +printf("Called atomic_stat(%s)\n", file_name); + while (stat (file_name, buf) != 0) + if (errno != EINTR) + return errno; +} diff -u read.c gread.c --- read.c Wed Jun 21 15:33:30 2000 +++ gread.c Thu Mar 8 14:40:39 2001 @@ -2464,7 +2464,7 @@ dir = expanded; } - if (stat (dir, &stbuf) == 0 && S_ISDIR (stbuf.st_mode)) + if (atomic_stat (dir, &stbuf) == 0 && S_ISDIR (stbuf.st_mode)) { if (idx == max - 1) { @@ -2497,7 +2497,7 @@ #endif for (i = 0; default_include_directories[i] != 0; ++i) - if (stat (default_include_directories[i], &stbuf) == 0 + if (atomic_stat (default_include_directories[i], &stbuf) == 0 && S_ISDIR (stbuf.st_mode)) dirs[idx++] = default_include_directories[i]; diff -u remake.c gremake.c --- remake.c Tue Jun 20 10:00:17 2000 +++ gremake.c Thu Mar 8 14:48:25 2001 @@ -1228,13 +1213,12 @@ { struct stat st; - while (stat (name, &st) != 0) - if (errno != EINTR) - { - if (errno != ENOENT && errno != ENOTDIR) - perror_with_name ("stat:", name); - return NONEXISTENT_MTIME; - } + if (atomic_stat (name, &st) != 0) + { + if (errno != ENOENT && errno != ENOTDIR) + perror_with_name ("stat:", name); + return NONEXISTENT_MTIME; + } return FILE_TIMESTAMP_STAT_MODTIME (name, st); } diff -u vmsfunctions.c gvmsfunctions.c --- vmsfunctions.c Sat Feb 5 02:50:48 2000 +++ gvmsfunctions.c Thu Mar 8 14:40:48 2001 @@ -215,7 +215,7 @@ if (!(status & 1)) return -1; - status = stat (name, buf); + status = atomic_stat (name, buf); if (status) return -1; diff -u vpath.c gvpath.c --- vpath.c Tue Jun 13 10:24:45 2000 +++ gvpath.c Thu Mar 8 18:30:30 2001 @@ -515,7 +522,7 @@ #endif if (!exists_in_cache /* Makefile-mentioned file need not exist. */ - || stat (name, &st) == 0) /* Does it really exist? */ + || atomic_stat (name, &st) == 0) /* Does it really exist? */ { /* We have found a file. Store the name we found into *FILE for the caller. */