diff options
Diffstat (limited to 'utility.c')
-rw-r--r-- | utility.c | 15 |
1 files changed, 8 insertions, 7 deletions
@@ -46,8 +46,9 @@ int isDirectory(const char *name) | |||
46 | 46 | ||
47 | if (stat(name, &statBuf) < 0) | 47 | if (stat(name, &statBuf) < 0) |
48 | return FALSE; | 48 | return FALSE; |
49 | 49 | if (S_ISDIR(statBuf.st_mode)) | |
50 | return S_ISDIR(statBuf.st_mode); | 50 | return TRUE; |
51 | return(FALSE); | ||
51 | } | 52 | } |
52 | 53 | ||
53 | 54 | ||
@@ -467,8 +468,8 @@ int fullRead(int fd, char *buf, int len) | |||
467 | */ | 468 | */ |
468 | int | 469 | int |
469 | recursiveAction(const char *fileName, int recurse, int followLinks, | 470 | recursiveAction(const char *fileName, int recurse, int followLinks, |
470 | int (*fileAction) (const char *fileName), | 471 | int (*fileAction) (const char *fileName, struct stat* statbuf), |
471 | int (*dirAction) (const char *fileName)) | 472 | int (*dirAction) (const char *fileName, struct stat* statbuf)) |
472 | { | 473 | { |
473 | int status; | 474 | int status; |
474 | struct stat statbuf; | 475 | struct stat statbuf; |
@@ -487,7 +488,7 @@ recursiveAction(const char *fileName, int recurse, int followLinks, | |||
487 | if (recurse == FALSE) { | 488 | if (recurse == FALSE) { |
488 | if (S_ISDIR(statbuf.st_mode)) { | 489 | if (S_ISDIR(statbuf.st_mode)) { |
489 | if (dirAction != NULL) | 490 | if (dirAction != NULL) |
490 | return (dirAction(fileName)); | 491 | return (dirAction(fileName, &statbuf)); |
491 | else | 492 | else |
492 | return (TRUE); | 493 | return (TRUE); |
493 | } | 494 | } |
@@ -501,7 +502,7 @@ recursiveAction(const char *fileName, int recurse, int followLinks, | |||
501 | return (FALSE); | 502 | return (FALSE); |
502 | } | 503 | } |
503 | if (dirAction != NULL) { | 504 | if (dirAction != NULL) { |
504 | status = dirAction(fileName); | 505 | status = dirAction(fileName, &statbuf); |
505 | if (status == FALSE) { | 506 | if (status == FALSE) { |
506 | perror(fileName); | 507 | perror(fileName); |
507 | return (FALSE); | 508 | return (FALSE); |
@@ -531,7 +532,7 @@ recursiveAction(const char *fileName, int recurse, int followLinks, | |||
531 | if (fileAction == NULL) | 532 | if (fileAction == NULL) |
532 | return (TRUE); | 533 | return (TRUE); |
533 | else | 534 | else |
534 | return (fileAction(fileName)); | 535 | return (fileAction(fileName, &statbuf)); |
535 | } | 536 | } |
536 | return (TRUE); | 537 | return (TRUE); |
537 | } | 538 | } |