From 9ac369c2bdea688a5147215440587b03da992535 Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Tue, 3 Oct 2006 13:32:55 +0000 Subject: [PATCH] * 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). --- ChangeLog | 5 +++++ src/remove.c | 3 +++ 2 files changed, 8 insertions(+) diff --git a/ChangeLog b/ChangeLog index efd1b36..434c96c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,10 +1,15 @@ 2006-10-03 Jim Meyering + * 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. diff --git a/src/remove.c b/src/remove.c index ed2c846..9d681c6 100644 --- a/src/remove.c +++ b/src/remove.c @@ -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"), -- 2.7.4