]> git.ipfire.org Git - thirdparty/coreutils.git/commit
rmdir: fix --ignore-fail-on-non-empty with permissions errors
authorPádraig Brady <P@draigBrady.com>
Fri, 31 Jan 2020 01:46:40 +0000 (20:46 -0500)
committerPádraig Brady <P@draigBrady.com>
Tue, 4 Feb 2020 19:11:37 +0000 (19:11 +0000)
commit1f443fe57291918ba245b2ffb7cdc07e64630af4
tree6dcf3b66caca14a5d4aa68a4b7ee18134067d92a
parent709b4d9d8dc2d456a2209b5ef3d1aaf0f1f45a48
rmdir: fix --ignore-fail-on-non-empty with permissions errors

Since v6.10-21-ged5c4e7 `rmdir --ignore-fail-on-non-empty`
had reversed the failure status for directories that failed
to be removed for permissions reasons.  I.E. it would have
returned a failure status for such non empty dirs, and vice versa.

* src/rmdir.c (errno_may_be_non_empty): Rename from the
more confusing errno_may_be_empty(), and remove the EEXIST
case (specific to Solaris), which is moot here since
handled in errno_rmdir_non_empty().
(ignorable_failure): Fix the logic error so that
_non_ empty dirs are deemed to have ignorable failures.
(main): Fix clobbering of errno by is_empty_dir().
(remove_parents): Likewise.
* tests/rmdir/ignore.sh: Add a test case.
* THANKS.in: Add reporter who fixed the errno handling.
* NEWS: Mention the bug fix.
Fixes https://bugs.gnu.org/39364
NEWS
THANKS.in
src/rmdir.c
src/system.h
tests/rmdir/ignore.sh