From 3336e16fb39ca0fafa5185797f0f0b9431c2330d Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Tue, 3 Dec 2002 09:48:14 +0000 Subject: [PATCH] (IS_EINTR): Define. (safe_read): Use IS_EINTR in place of in-function cpp directives. --- lib/safe-read.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/lib/safe-read.c b/lib/safe-read.c index 0d0f29ddd..5d2cd9dde 100644 --- 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 #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; } -- 2.11.0