Using errno to print the error when unable to delete a directory
This commit is contained in:
parent
bb4384a0c0
commit
a65a1a5d5c
6
src/rm.c
6
src/rm.c
|
@ -23,6 +23,7 @@
|
|||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
|
||||
|
||||
/* types */
|
||||
|
@ -79,9 +80,8 @@ static int _rm_do(Prefs * prefs, char * file)
|
|||
{
|
||||
if(!(*prefs & PREFS_R))
|
||||
{
|
||||
fprintf(stderr, "%s%s%s", "rm: ", file,
|
||||
": Is a directory\n");
|
||||
return 0;
|
||||
errno = EISDIR;
|
||||
return _rm_error(file, 0);
|
||||
}
|
||||
return _rm_do_recursive(prefs, file);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user