summaryrefslogtreecommitdiff
path: root/misc.c
diff options
context:
space:
mode:
Diffstat (limited to 'misc.c')
-rw-r--r--misc.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/misc.c b/misc.c
index 6e2b570..669dabc 100644
--- a/misc.c
+++ b/misc.c
@@ -856,3 +856,38 @@ get_path_max ()
return value;
}
#endif
+
+
+#ifdef HAVE_BROKEN_RESTART
+
+#undef stat
+#undef readdir
+
+int
+atomic_stat(file, buf)
+ const char *file;
+ struct stat *buf;
+{
+ int r;
+
+ while ((r = stat (file, buf)) < 0)
+ if (errno != EINTR)
+ break;
+
+ return r;
+}
+
+struct dirent *
+atomic_readdir(dir)
+ DIR *file;
+{
+ struct dirent *r;
+
+ while ((r = readdir (file, buf)) == NULL)
+ if (errno != EINTR)
+ break;
+
+ return r;
+}
+
+#endif /* HAVE_BROKEN_RESTART */