coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[coreutils] [PATCH] copy, tee: assume EINTR is always defined: remove #i


From: Jim Meyering
Subject: [coreutils] [PATCH] copy, tee: assume EINTR is always defined: remove #ifdefs
Date: Sun, 30 Jan 2011 16:40:14 +0100

FYI, I'm pushing this to the fiemap-copy branch
that will shortly be pulled to master.

>From 372479c4afb7f3da2cd72e200a2afe65d718cb42 Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Sun, 30 Jan 2011 16:12:56 +0100
Subject: [PATCH] copy, tee: assume EINTR is always defined: remove #ifdefs

Don't use "#ifdef EINTR".  dd.c has been doing that since 2004.
* src/copy.c (sparse_copy): Remove #ifdef...#endif around EINTR use.
* src/tee.c (tee_files): Remove #ifdef...#endif around EINTR use.
If we need it, add something like this in system.h:
/* When EINTR is not defined, define it to an improbable value
   so that each use does not have to be #ifdef'd.  */
 #ifndef EINTR
 # define EINTR 999988
 #endif
---
 src/copy.c |    2 --
 src/tee.c  |    2 --
 2 files changed, 0 insertions(+), 4 deletions(-)

diff --git a/src/copy.c b/src/copy.c
index 96bb35b..4e73e1b 100644
--- a/src/copy.c
+++ b/src/copy.c
@@ -160,10 +160,8 @@ sparse_copy (int src_fd, int dest_fd, char *buf, size_t 
buf_size,
       ssize_t n_read = read (src_fd, buf, MIN (max_n_read, buf_size));
       if (n_read < 0)
         {
-#ifdef EINTR
           if (errno == EINTR)
             continue;
-#endif
           error (0, errno, _("reading %s"), quote (src_name));
           return false;
         }
diff --git a/src/tee.c b/src/tee.c
index 0499442..0518b07 100644
--- a/src/tee.c
+++ b/src/tee.c
@@ -183,10 +183,8 @@ tee_files (int nfiles, const char **files)
   while (1)
     {
       bytes_read = read (0, buffer, sizeof buffer);
-#ifdef EINTR
       if (bytes_read < 0 && errno == EINTR)
         continue;
-#endif
       if (bytes_read <= 0)
         break;

--
1.7.3.5.44.g960a



reply via email to

[Prev in Thread] Current Thread [Next in Thread]