(safe_stat): New function, EINTR-safe wrapper around stat.
authorRoland McGrath <roland@redhat.com>
Mon, 4 Jul 1994 21:46:58 +0000 (21:46 +0000)
committerRoland McGrath <roland@redhat.com>
Mon, 4 Jul 1994 21:46:58 +0000 (21:46 +0000)
misc.c

diff --git a/misc.c b/misc.c
index 06be0b2..b9e76b9 100644 (file)
--- a/misc.c
+++ b/misc.c
@@ -716,3 +716,23 @@ get_path_max ()
   return value;
 }
 #endif
+\f
+/* 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;
+}