]> git.ipfire.org Git - thirdparty/coreutils.git/commit
cp: fix security context race
authorPaul Eggert <eggert@cs.ucla.edu>
Wed, 17 Nov 2021 21:22:06 +0000 (13:22 -0800)
committerPaul Eggert <eggert@cs.ucla.edu>
Thu, 18 Nov 2021 16:31:59 +0000 (08:31 -0800)
commitd0f035fc64fb348cb092fbb6ae7e8ce76b4d82db
tree1cb743eeda83b1d8a04a7735e66337deed308af8
parent0f84467a348fce8cefb82af4d543da21007538ca
cp: fix security context race

This fixes an issue introduced in the fix for Bug#11100.
* NEWS: Mention this.
* src/copy.c (copy_reg): Fix obscure bug where open-without-CREAT
failed with ENOENT and we forget to call set_process_security_ctx
before calling open-with-CREAT. Also, don’t bother to unlink
DST_NAME if open failed with ENOENT; and if unlink fails with
ENOENT, don’t consider that to be an error (someone else could
have removed the file for us, and that’s OK).  Also, don’t worry
about move mode, since we use O_EXCL|O_CREAT and so won’t open
an existing file.
NEWS
src/copy.c