bug-gnulib
[Top][All Lists]
Advanced

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

[PATCH] execute: drop dead code


From: Eric Blake
Subject: [PATCH] execute: drop dead code
Date: Tue, 5 Mar 2013 12:52:34 -0700

On several platforms, I noticed this compile warning:
gcc -DHAVE_CONFIG_H -I. -I../../gllib -I..  -DGNULIB_STRICT_CHECKING=1   -Wall 
-MT execute.o -MD -MP -MF .deps/execute.Tpo -c -o execute.o 
../../gllib/execute.c
../../gllib/execute.c:64:1: warning: ‘nonintr_close’ defined but not used 
[-Wunused-function]
../../gllib/execute.c:77:1: warning: ‘nonintr_open’ defined but not used 
[-Wunused-function]

The warning first surfaced when commit bdaf232 (Nov 2012) finally
pointed out that these wrappers were no longer needed on posix-y
systems, although the code has been unused since commit d629f6d
(Jan 2009) which removed all use of open()/close() in favor of
posix_spawn() instead.  The only platform remaining where the
wrappers are used (and no warnings issued) is mingw, but according
to Microsoft's documentation [1] at the time of this patch, mingw's
libc never fails open or close with EINTR (not to mention that
the documented purpose of the wrapper is for SIGSTOP, which mingw
doesn't really have).

[1]http://msdn.microsoft.com/en-us/library/z0kc8e3z%28v=vs.80%29.aspx

* lib/execute.c (nonintr_close, nonintr_open): Delete.

Signed-off-by: Eric Blake <address@hidden>
---
 ChangeLog     |  5 +++++
 lib/execute.c | 36 ------------------------------------
 2 files changed, 5 insertions(+), 36 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 725fe13..04db5df 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2013-03-05  Eric Blake  <address@hidden>
+
+       execute: drop dead code
+       * lib/execute.c (nonintr_close, nonintr_open): Delete.
+
 2013-03-04  Eric Blake  <address@hidden>

        test-getsockopt: avoid compiler warning
diff --git a/lib/execute.c b/lib/execute.c
index 4f0dcc3..cf547fe 100644
--- a/lib/execute.c
+++ b/lib/execute.c
@@ -54,42 +54,6 @@
 #undef close


-#ifdef EINTR
-
-/* EINTR handling for close(), open().
-   These functions can return -1/EINTR even though we don't have any
-   signal handlers set up, namely when we get interrupted via SIGSTOP.  */
-
-static int
-nonintr_close (int fd)
-{
-  int retval;
-
-  do
-    retval = close (fd);
-  while (retval < 0 && errno == EINTR);
-
-  return retval;
-}
-#define close nonintr_close
-
-static int
-nonintr_open (const char *pathname, int oflag, mode_t mode)
-{
-  int retval;
-
-  do
-    retval = open (pathname, oflag, mode);
-  while (retval < 0 && errno == EINTR);
-
-  return retval;
-}
-#undef open /* avoid warning on VMS */
-#define open nonintr_open
-
-#endif
-
-
 /* Execute a command, optionally redirecting any of the three standard file
    descriptors to /dev/null.  Return its exit code.
    If it didn't terminate correctly, exit if exit_on_error is true, otherwise
-- 
1.8.1.4




reply via email to

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