Only remove directories when removing recursively.
This commit is contained in:
parent
cff3fe3ae9
commit
7c22b77162
@ -45,6 +45,11 @@ static int fileAction(const char *fileName, struct stat *statbuf, void* junk)
|
||||
|
||||
static int dirAction(const char *fileName, struct stat *statbuf, void* junk)
|
||||
{
|
||||
if (recursiveFlag == FALSE) {
|
||||
errno = EISDIR;
|
||||
perror(fileName);
|
||||
return (FALSE);
|
||||
}
|
||||
if (rmdir(fileName) < 0) {
|
||||
perror(fileName);
|
||||
return (FALSE);
|
||||
|
5
rm.c
5
rm.c
@ -45,6 +45,11 @@ static int fileAction(const char *fileName, struct stat *statbuf, void* junk)
|
||||
|
||||
static int dirAction(const char *fileName, struct stat *statbuf, void* junk)
|
||||
{
|
||||
if (recursiveFlag == FALSE) {
|
||||
errno = EISDIR;
|
||||
perror(fileName);
|
||||
return (FALSE);
|
||||
}
|
||||
if (rmdir(fileName) < 0) {
|
||||
perror(fileName);
|
||||
return (FALSE);
|
||||
|
Loading…
Reference in New Issue
Block a user