summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Youngman <jay@gnu.org>2011-06-14 00:09:42 +0100
committerJames Youngman <jay@gnu.org>2011-06-14 00:22:44 +0100
commit4f1a351a23a0995faba9cc72f51d02fdeaa8f38e (patch)
treeb0245bec4c03198cc4dc3da1a24d892f74802b67
parent30056f0b4fa922b54cdd2747f29af67e2c729894 (diff)
downloadfindutils-4f1a351a23a0995faba9cc72f51d02fdeaa8f38e.tar.gz
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.
-rw-r--r--ChangeLog10
-rw-r--r--find/exec.c8
-rw-r--r--find/find.c9
-rw-r--r--xargs/xargs.c5
4 files changed, 13 insertions, 19 deletions
diff --git a/ChangeLog b/ChangeLog
index 3a1ae3be..0e8b8f46 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,15 @@
2011-06-14 James Youngman <jay@gnu.org>
+ 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 <jay@gnu.org>
+
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 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 <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"