projects
/
pspp
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
2cb98f7
)
(IS_EINTR): Define.
author
Jim Meyering
<jim@meyering.net>
Tue, 3 Dec 2002 09:48:14 +0000
(09:48 +0000)
committer
Jim 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
patch
|
blob
|
history
diff --git
a/lib/safe-read.c
b/lib/safe-read.c
index 0d0f29dddfe539f1fed0226cfbc658ef8d3b9f20..5d2cd9dded91145d9a65d5330d73d96333ac92a2 100644
(file)
--- 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
@@
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;
}