summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--misc.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/misc.c b/misc.c
index 06be0b2..b9e76b9 100644
--- a/misc.c
+++ b/misc.c
@@ -716,3 +716,23 @@ get_path_max ()
return value;
}
#endif
+
+/* On some systems, stat can return EINTR. */
+
+int
+safe_stat (name, buf)
+ char *name;
+ struct stat *buf;
+{
+ int ret;
+
+#ifdef EINTR
+ do
+#endif
+ ret = stat (name, buf);
+#ifdef EINTR
+ while (ret < 0 && errno == EINTR);
+#endif
+
+ return ret;
+}