diff options
author | Bernhard Voelker <mail@bernhard-voelker.de> | 2012-12-08 19:09:19 +0100 |
---|---|---|
committer | Bernhard Voelker <mail@bernhard-voelker.de> | 2012-12-08 19:09:19 +0100 |
commit | 62543570d72b756a3b04ca9d1ebec6f4dd2eea4b (patch) | |
tree | 2260d931c4e39872e29175f3c75d3517b7a187bc /src | |
parent | 10d35b438e731f6f0c1528d4855cdb9cf8b88349 (diff) | |
download | coreutils-62543570d72b756a3b04ca9d1ebec6f4dd2eea4b.tar.xz |
cp: fix --no-preserve=mode to not exit 1
cp --no-preserve=mode exited 1 unconditionally. Furthermore,
the tests which would have detected this error - namely
link-preserve.sh and reserve-mode.sh - failed to test
cp's exit code.
* src/copy.c (copy_reg): In the case x->explicit_no_preserve_mode,
do only set return_val to false iff the previous set_acl ()
failed.
* tests/cp/link-preserve.sh: Check cp's exit code.
* tests/cp/link-symlink.sh: Likewise.
* tests/cp/preserve-mode.sh: Likewise.
* NEWS: Mention the fix.
Bug introduced in commit v8.19-145-g24ebca6.
Reported by Florian Pritz in http://bugs.gnu.org/13119.
Diffstat (limited to 'src')
-rw-r--r-- | src/copy.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/copy.c b/src/copy.c index 7a354140a..0decf9f9f 100644 --- a/src/copy.c +++ b/src/copy.c @@ -1153,8 +1153,8 @@ preserve_metadata: } else if (x->explicit_no_preserve_mode) { - set_acl (dst_name, dest_desc, 0666 & ~cached_umask ()); - return_val = false; + if (set_acl (dst_name, dest_desc, 0666 & ~cached_umask ()) != 0) + return_val = false; } else if (omitted_permissions) { |