Skip to content

Commit c4e54ec

Browse files
committed
bin/xbps-remove: ignore ENOENT errors when removing files
Fixes #482.
1 parent 0f06d02 commit c4e54ec

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

bin/xbps-remove/main.c

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
#include <string.h>
3030
#include <strings.h>
3131
#include <errno.h>
32-
#include <signal.h>
3332
#include <assert.h>
3433
#include <unistd.h>
3534
#include <getopt.h>
@@ -103,8 +102,15 @@ state_cb_rm(const struct xbps_state_cb_data *xscd, void *cbdata UNUSED)
103102
case XBPS_STATE_REMOVE_FILE_FAIL:
104103
case XBPS_STATE_REMOVE_FILE_HASH_FAIL:
105104
case XBPS_STATE_REMOVE_FILE_OBSOLETE_FAIL:
106-
/* Ignore errors due to not empty directories or directories being a mount point */
107-
if (xscd->err == ENOTEMPTY || xscd->err == EBUSY)
105+
/* Ignore errors due to:
106+
* - ENOTEMPTY: non-empty directories.
107+
* - EBUSY: directories being a mount point.
108+
* - ENOENT: files not existing.
109+
* XXX: could EBUSY also appear for files which
110+
* are not mount points and what should happen if this
111+
* is the case.
112+
*/
113+
if (xscd->err == ENOTEMPTY || xscd->err == EBUSY || xscd->err == ENOENT)
108114
return 0;
109115

110116
xbps_error_printf("%s\n", xscd->desc);

0 commit comments

Comments
 (0)