changeset 4050:2995e830608c

(IS_EINTR): Define. (safe_read): Use IS_EINTR in place of in-function cpp directives.
author Jim Meyering <jim@meyering.net>
date Tue, 03 Dec 2002 09:48:14 +0000
parents 6a1238f585b1
children 90298dc3fd6c
files lib/safe-read.c
diffstat 1 files changed, 7 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/lib/safe-read.c
+++ b/lib/safe-read.c
@@ -33,6 +33,12 @@
 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 @@
     {
       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;
 }