summaryrefslogtreecommitdiff
path: root/bootstrap.conf
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2018-10-19 12:19:43 -0700
committerPaul Eggert <eggert@cs.ucla.edu>2018-10-19 12:38:34 -0700
commit571f63f5010b047a8a3250304053f05949faded4 (patch)
treea207753907f2ad471fb6078a8970f987eeebc0f1 /bootstrap.conf
parentcbc427485e8c202b8aeae567f99c4a080a55adac (diff)
downloadcoreutils-571f63f5010b047a8a3250304053f05949faded4.tar.gz
ln: avoid directory hard-link races
Previously, 'ln A B' did 'stat("B"), lstat("A"), link("A","B")' where the stat and lstat were necessary to avoid hard-linking directories on systems that can hard-link directories. Now, in situations that prohibit hard links to directories, 'ln A B' merely does 'link("A","B")'. The new behavior avoids some races and should be more efficient. This patch was inspired by Bug#10020, which was about 'ln'. * bootstrap.conf (gnulib_modules): Add unlinkdir. * src/force-link.c (force_linkat, force_symlinkat): New arg for error number of previous try. Return error number, 0, or -1 if error, success, or success after removal. All callers changed. * src/ln.c: Include priv-set.h, unlinkdir.h. (beware_hard_dir_link): New static var. (errnoize, atomic_link): New functions. (target_directory_operand): Use errnoize for simplicity. (do_link): New arg for error number of previous try. All callers changed. Do each link atomically if possible. (main): Do -r check earlier. Remove linkdir privileges so we can use a single linkat/symlinkat instead of a racy substitute for the common case of 'ln A B' and 'ln -s A B'. Set beware_hard_dir_link to disable this optimization.
Diffstat (limited to 'bootstrap.conf')
-rw-r--r--bootstrap.conf1
1 files changed, 1 insertions, 0 deletions
diff --git a/bootstrap.conf b/bootstrap.conf
index fcf29dc23..f193a5825 100644
--- a/bootstrap.conf
+++ b/bootstrap.conf
@@ -257,6 +257,7 @@ gnulib_modules="
unistd-safer
unlink-busy
unlinkat
+ unlinkdir
unlocked-io
unsetenv
update-copyright