From 4f1a351a23a0995faba9cc72f51d02fdeaa8f38e Mon Sep 17 00:00:00 2001 From: James Youngman Date: Tue, 14 Jun 2011 00:09:42 +0100 Subject: 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. --- 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 3a1ae3be..0e8b8f46 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2011-06-14 James Youngman + + 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 Fix coredump bug introduced in the previous change. diff --git a/find/exec.c b/find/exec.c index db4c0297..95e3c6b9 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 9dcfbd5d..09fb5a10 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 e64cc99d..eaa33e0f 100644 --- a/xargs/xargs.c +++ b/xargs/xargs.c @@ -57,12 +57,7 @@ #include #include -#if defined SIGCLD && !defined SIGCHLD -#define SIGCHLD SIGCLD -#endif - #include "verify.h" - #include "progname.h" #include "quotearg.h" #include "findutils-version.h" -- cgit v1.2.1