(IS_EINTR): Define.
authorJim Meyering <jim@meyering.net>
Tue, 3 Dec 2002 09:48:14 +0000 (09:48 +0000)
committerJim Meyering <jim@meyering.net>
Tue, 3 Dec 2002 09:48:14 +0000 (09:48 +0000)
(safe_read): Use IS_EINTR in place of in-function cpp directives.

lib/safe-read.c

index 0d0f29d..5d2cd9d 100644 (file)
 extern int errno;
 #endif
 
+#ifdef EINTR
+# define IS_EINTR(x) ((x) == EINTR)
+#else
+# define IS_EINTR(x) 0
+#endif
+
 #include <limits.h>
 
 #ifndef CHAR_BIT
@@ -77,11 +83,7 @@ safe_read (int fd, void *buf, size_t count)
     {
       result = read (fd, buf, nbytes_to_read);
     }
-#ifdef EINTR
-  while (result < 0 && errno == EINTR);
-#else
-  while (0);
-#endif
+  while (result < 0 && IS_EINTR (errno));
 
   return (size_t) result;
 }