bug-findutils
[Top][All Lists]
Advanced

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

[PATCH] Assume SIGCHLD and O_NOFOLLOW are defined by gnulib.


From: James Youngman
Subject: [PATCH] Assume SIGCHLD and O_NOFOLLOW are defined by gnulib.
Date: Tue, 14 Jun 2011 00:24:57 +0100

* find/find.c: Since gnulib defines O_NOFOLLOW, don't check to see
if the macro is defined.  Check instead to see if it is 0.
(safely_chdir_nofollow): Point this out.
(safely_chdir): Check O_NOFOLLOW for zeroness.
* find/exec.c: Don't #define SIGCHLD.
* xargs/xargs.c: Likewise.
---
 ChangeLog     |   10 ++++++++++
 find/exec.c   |    8 --------
 find/find.c   |    9 +++------
 xargs/xargs.c |    5 -----
 4 files changed, 13 insertions(+), 19 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 3a1ae3b..0e8b8f4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,15 @@
 2011-06-14  James Youngman  <address@hidden>
 
+       Assume SIGCHLD and O_NOFOLLOW are defined by gnulib.
+       * find/find.c: Since gnulib defines O_NOFOLLOW, don't check to see
+       if the macro is defined.  Check instead to see if it is 0.
+       (safely_chdir_nofollow): Point this out.
+       (safely_chdir): Check O_NOFOLLOW for zeroness.
+       * find/exec.c: Don't #define SIGCHLD.
+       * xargs/xargs.c: Likewise.
+
+2011-06-14  James Youngman  <address@hidden>
+
        Fix coredump bug introduced in the previous change.
        * locate/locate.c (dolocate): Remove declaration of e, which was
        replaced by the variable db_name.  Change the last two uses of 'e'
diff --git a/find/exec.c b/find/exec.c
index db4c029..95e3c6b 100644
--- a/find/exec.c
+++ b/find/exec.c
@@ -53,14 +53,6 @@
 #endif
 
 
-#if defined SIGCLD && !defined SIGCHLD
-# define SIGCHLD SIGCLD
-#endif
-
-
-
-
-
 /* Initialise exec->wd_for_exec.
 
    We save in exec->wd_for_exec the directory whose path relative to
diff --git a/find/find.c b/find/find.c
index 9dcfbd5..09fb5a1 100644
--- a/find/find.c
+++ b/find/find.c
@@ -776,7 +776,6 @@ safely_chdir_lstat (const char *dest,
   return rv;
 }
 
-#if defined O_NOFOLLOW
 /* Safely change working directory to the specified subdirectory.  If
  * we are not allowed to follow symbolic links, we use open() with
  * O_NOFOLLOW, followed by fchdir().  This ensures that we don't
@@ -808,7 +807,7 @@ safely_chdir_nofollow (const char *dest,
       if (following_links ())
        extraflags = 0;
       else
-       extraflags = O_NOFOLLOW;
+       extraflags = O_NOFOLLOW; /* ... which may still be 0. */
       break;
     }
 
@@ -860,7 +859,6 @@ safely_chdir_nofollow (const char *dest,
        }
     }
 }
-#endif
 
 static enum SafeChdirStatus
 safely_chdir (const char *dest,
@@ -878,9 +876,8 @@ safely_chdir (const char *dest,
    */
   complete_pending_execdirs ();
 
-#if !defined O_NOFOLLOW
-  options.open_nofollow_available = false;
-#endif
+  /* gnulib defines O_NOFOLLOW to 0 if the OS doesn't have it. */
+  options.open_nofollow_available = !!O_NOFOLLOW;
   if (options.open_nofollow_available)
     {
       result = safely_chdir_nofollow (dest, direction, statbuf_dest,
diff --git a/xargs/xargs.c b/xargs/xargs.c
index e64cc99..eaa33e0 100644
--- a/xargs/xargs.c
+++ b/xargs/xargs.c
@@ -57,12 +57,7 @@
 #include <wchar.h>
 #include <stdint.h>
 
-#if defined SIGCLD && !defined SIGCHLD
-#define SIGCHLD SIGCLD
-#endif
-
 #include "verify.h"
-
 #include "progname.h"
 #include "quotearg.h"
 #include "findutils-version.h"
-- 
1.7.2.5




reply via email to

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