mirror of
https://github.com/sheumann/hush.git
synced 2025-01-03 16:29:50 +00:00
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)
|
static int dirAction(const char *fileName, struct stat *statbuf, void* junk)
|
||||||
{
|
{
|
||||||
|
if (recursiveFlag == FALSE) {
|
||||||
|
errno = EISDIR;
|
||||||
|
perror(fileName);
|
||||||
|
return (FALSE);
|
||||||
|
}
|
||||||
if (rmdir(fileName) < 0) {
|
if (rmdir(fileName) < 0) {
|
||||||
perror(fileName);
|
perror(fileName);
|
||||||
return (FALSE);
|
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)
|
static int dirAction(const char *fileName, struct stat *statbuf, void* junk)
|
||||||
{
|
{
|
||||||
|
if (recursiveFlag == FALSE) {
|
||||||
|
errno = EISDIR;
|
||||||
|
perror(fileName);
|
||||||
|
return (FALSE);
|
||||||
|
}
|
||||||
if (rmdir(fileName) < 0) {
|
if (rmdir(fileName) < 0) {
|
||||||
perror(fileName);
|
perror(fileName);
|
||||||
return (FALSE);
|
return (FALSE);
|
||||||
|
Loading…
Reference in New Issue
Block a user