sbase/libutil/rm.c
FRIGN 48696d8c95 Fix exit status with -f for nonexistent paths
Thanks Michael Forney <mforney@mforney.org> for reporting this!
2015-03-01 23:48:50 +01:00

23 lines
401 B
C

/* See LICENSE file for copyright and license details. */
#include <errno.h>
#include <stdio.h>
#include "../fs.h"
#include "../util.h"
int rm_fflag = 0;
int rm_rflag = 0;
int rm_status = 0;
void
rm(const char *path, int unused)
{
if (rm_rflag)
recurse(path, rm, 'P');
if (remove(path) < 0) {
if (!rm_fflag)
weprintf("remove %s:", path);
rm_status = !(rm_fflag && errno == ENOENT);
}
}