1 >From 6689e8db4f53f6a0bed3d1bc4ed12d31eaa3bf51 Mon Sep 17 00:00:00 2001
2 From: Paul Eggert <eggert@cs.ucla.edu>
3 Date: Tue, 17 Jan 2012 22:21:52 -0800
4 Subject: [PATCH] tar: port --overwrite symlink test to GNU/Hurd
6 Problem reported by Pino Toscano in
7 <http://lists.gnu.org/archive/html/bug-tar/2012-01/msg00040.html>.
8 * gnulib.modules: Add fcntl-h, which defines
9 HAVE_WORKING_O_NOFOLLOW.
10 * src/extract.c (open_output_file): Use HAVE_WORKING_O_NOFOLLOW,
11 not O_NOFOLLOW, when testing whther O_NOFOLLOW works.
13 This file is a placeholder. It will be replaced with the actual ChangeLog
14 by make dist. Run make ChangeLog if you wish to create it earlier.
18 2 files changed, 3 insertions(+), 1 deletion(-)
20 diff --git a/src/extract.c b/src/extract.c
21 index 55f3eb8..bd5e7bf 100644
24 @@ -887,7 +887,8 @@ open_output_file (char const *file_name, int typeflag, mode_t mode,
25 /* If O_NOFOLLOW is needed but does not work, check for a symlink
26 separately. There's a race condition, but that cannot be avoided
27 on hosts lacking O_NOFOLLOW. */
28 - if (! O_NOFOLLOW && overwriting_old_files && ! dereference_option)
29 + if (! HAVE_WORKING_O_NOFOLLOW
30 + && overwriting_old_files && ! dereference_option)
33 if (fstatat (chdir_fd, file_name, &st, AT_SYMLINK_NOFOLLOW) == 0