Fix return values in rm(1) and mv(1)
by setting rm_status to 1 if removing 1 file in the list fails. Extend this to mv_status in mv(1).
This commit is contained in:
@@ -6,12 +6,16 @@
|
||||
|
||||
int rm_fflag = 0;
|
||||
int rm_rflag = 0;
|
||||
int rm_status = 0;
|
||||
|
||||
void
|
||||
rm(const char *path)
|
||||
{
|
||||
if (rm_rflag)
|
||||
recurse(path, rm);
|
||||
if (remove(path) < 0 && !rm_fflag)
|
||||
eprintf("remove %s:", path);
|
||||
if (remove(path) < 0) {
|
||||
if (!rm_fflag)
|
||||
weprintf("remove %s:", path);
|
||||
rm_status = 1;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user