# HG changeset patch # User Jim Meyering # Date 1038908894 0 # Node ID 2995e830608cf0f001327c0dba82cb47742262fd # Parent 6a1238f585b1068bcedc4204bf8befffd430f5ea (IS_EINTR): Define. (safe_read): Use IS_EINTR in place of in-function cpp directives. diff --git a/lib/safe-read.c b/lib/safe-read.c --- 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 @@ { 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; }