Using errno to print the error when unable to delete a directory

This commit is contained in:
Pierre Pronchery 2007-06-18 02:28:50 +00:00
parent bb4384a0c0
commit a65a1a5d5c

View File

@ -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);
}