Fix bug where "rm" gave up too easily, reported by Dan Jacobsen in
authorJim Meyering <jim@meyering.net>
Sat, 8 May 2004 12:49:22 +0000 (12:49 +0000)
committerJim Meyering <jim@meyering.net>
Sat, 8 May 2004 12:49:22 +0000 (12:49 +0000)
commit2e83808dd6db78feacef25035fcbadd7f05625c4
tree9802d4fe244c08c74e88672cb4e724c27c318c47
parent198dc407d36fc14325d34d533939653719c64be6
Fix bug where "rm" gave up too easily, reported by Dan Jacobsen in
<http://mail.gnu.org/archive/html/bug-coreutils/2004-05/msg00013.html>.

(remove_entry): Check for errno values like ENOENT
that show the file cannot be directory, instead of for errno
values like EPERM that show the file might be a directory.  This
is necessary because, when a single unlink() call has multiple
reasons to fail, it can set errno to any of those reasons; it's
only the rare errno value like ENOENT that excludes all the other
possible reasons to fail even when the file is a directory.
(remove_cwd_entries): Don't attempt chdir if the file is known
to not be a directory.
(remove_dir): Use the same method that remove_cwd_entries uses
(for some reason they differed).  Don't assert that saved_errno
must be EPERM; it might be just about anything.
src/remove.c