diff options
Diffstat (limited to 'utility.c')
-rw-r--r-- | utility.c | 11 |
1 files changed, 9 insertions, 2 deletions
@@ -396,7 +396,7 @@ recursiveAction(const char *fileName, int recurse, int followLinks, int depthFir | |||
396 | int (*dirAction) (const char *fileName, struct stat* statbuf)) | 396 | int (*dirAction) (const char *fileName, struct stat* statbuf)) |
397 | { | 397 | { |
398 | int status; | 398 | int status; |
399 | struct stat statbuf; | 399 | struct stat statbuf, statbuf1; |
400 | struct dirent *next; | 400 | struct dirent *next; |
401 | 401 | ||
402 | if (followLinks == TRUE) | 402 | if (followLinks == TRUE) |
@@ -404,6 +404,7 @@ recursiveAction(const char *fileName, int recurse, int followLinks, int depthFir | |||
404 | else | 404 | else |
405 | status = lstat(fileName, &statbuf); | 405 | status = lstat(fileName, &statbuf); |
406 | 406 | ||
407 | status = lstat(fileName, &statbuf); | ||
407 | if (status < 0) { | 408 | if (status < 0) { |
408 | perror(fileName); | 409 | perror(fileName); |
409 | return (FALSE); | 410 | return (FALSE); |
@@ -424,8 +425,14 @@ recursiveAction(const char *fileName, int recurse, int followLinks, int depthFir | |||
424 | return (TRUE); | 425 | return (TRUE); |
425 | } | 426 | } |
426 | } | 427 | } |
428 | |||
429 | status = lstat(fileName, &statbuf1); | ||
430 | if (status < 0) { | ||
431 | perror(fileName); | ||
432 | return (FALSE); | ||
433 | } | ||
427 | 434 | ||
428 | if (S_ISDIR(statbuf.st_mode)) { | 435 | if (S_ISDIR(statbuf.st_mode) && S_ISDIR(statbuf1.st_mode)) { |
429 | DIR *dir; | 436 | DIR *dir; |
430 | dir = opendir(fileName); | 437 | dir = opendir(fileName); |
431 | if (!dir) { | 438 | if (!dir) { |