cp: handle a race condition more sensibly
authorJim Meyering <meyering@redhat.com>
Fri, 4 May 2012 14:42:31 +0000 (16:42 +0200)
committerJim Meyering <meyering@redhat.com>
Mon, 7 May 2012 11:39:48 +0000 (13:39 +0200)
commitee9e43460f366406edff96b5abfb3ff33587e062
tree7451920817eb2c42bcc4aee062074f46e2f9d041
parent3468d26884800d7bc6fcc1ba52cd481175c655d8
cp: handle a race condition more sensibly

* src/copy.c (copy_reg): In a narrow race (stat sees dest, yet
open-without-O_CREAT fails with ENOENT), retry the open with O_CREAT.
* tests/cp/nfs-removal-race: New file.
* tests/Makefile.am (TESTS): Add it.
* NEWS (Bug fixes): Mention it.
Reported by Philipp Thomas and Neil F. Brown in
http://bugs.gnu.org/11100
NEWS
THANKS.in
src/copy.c
tests/Makefile.am
tests/cp/nfs-removal-race [new file with mode: 0755]