* src/remove.c (remove_entry): With -f, exit successfully in spite
authorJim Meyering <jim@meyering.net>
Tue, 3 Oct 2006 13:32:55 +0000 (13:32 +0000)
committerJim Meyering <jim@meyering.net>
Tue, 3 Oct 2006 13:32:55 +0000 (13:32 +0000)
of a missing file under some very unusual conditions (with errno
being any of ENOENT, ENOTDIR, ENAMETOOLONG).

ChangeLog
src/remove.c

index efd1b36..434c96c 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,10 +1,15 @@
 2006-10-03  Jim Meyering  <jim@meyering.net>
 
+       * src/remove.c (remove_entry): With -f, exit successfully in spite
+       of a missing file under some very unusual conditions (with errno
+       being any of ENOENT, ENOTDIR, ENAMETOOLONG).
+
        With --force (-f), rm no longer fails for ENOTDIR.
        * src/remove.c (ignorable_missing): New function.
        Use it everywhere, rather than open-coding the test.
        Andreas Schwab reported the ENOTDIR problem.
        (ignorable_missing): Similarly, don't fail for ENAMETOOLONG.
+
        * NEWS: Mention the bug fix.
        * tests/rm/ignorable: New file.  Test for the ENOTDIR case.
        * tests/rm/ignore-name-too-long: New file. Test for ENAMETOOLONG.
index ed2c846..9d681c6 100644 (file)
@@ -1016,6 +1016,9 @@ remove_entry (int fd_cwd, Dirstack_state const *ds, char const *filename,
          || errno == ENOENT || errno == ENOTDIR
          || errno == ELOOP || errno == ENAMETOOLONG)
        {
+         if (ignorable_missing (x, errno))
+           return RM_OK;
+
          /* Either --recursive is not in effect, or the file cannot be a
             directory.  Report the unlink problem and fail.  */
          error (0, errno, _("cannot remove %s"),