diff options
Diffstat (limited to 'utility.c')
-rw-r--r-- | utility.c | 32 |
1 files changed, 11 insertions, 21 deletions
@@ -542,9 +542,12 @@ int fullRead(int fd, char *buf, int len) | |||
542 | int recursiveAction(const char *fileName, | 542 | int recursiveAction(const char *fileName, |
543 | int recurse, int followLinks, int depthFirst, | 543 | int recurse, int followLinks, int depthFirst, |
544 | int (*fileAction) (const char *fileName, | 544 | int (*fileAction) (const char *fileName, |
545 | struct stat * statbuf), | 545 | struct stat * statbuf, |
546 | void* userData), | ||
546 | int (*dirAction) (const char *fileName, | 547 | int (*dirAction) (const char *fileName, |
547 | struct stat * statbuf)) | 548 | struct stat * statbuf, |
549 | void* userData), | ||
550 | void* userData) | ||
548 | { | 551 | { |
549 | int status; | 552 | int status; |
550 | struct stat statbuf; | 553 | struct stat statbuf; |
@@ -569,13 +572,13 @@ int recursiveAction(const char *fileName, | |||
569 | if (fileAction == NULL) | 572 | if (fileAction == NULL) |
570 | return TRUE; | 573 | return TRUE; |
571 | else | 574 | else |
572 | return fileAction(fileName, &statbuf); | 575 | return fileAction(fileName, &statbuf, userData); |
573 | } | 576 | } |
574 | 577 | ||
575 | if (recurse == FALSE) { | 578 | if (recurse == FALSE) { |
576 | if (S_ISDIR(statbuf.st_mode)) { | 579 | if (S_ISDIR(statbuf.st_mode)) { |
577 | if (dirAction != NULL) | 580 | if (dirAction != NULL) |
578 | return (dirAction(fileName, &statbuf)); | 581 | return (dirAction(fileName, &statbuf, userData)); |
579 | else | 582 | else |
580 | return TRUE; | 583 | return TRUE; |
581 | } | 584 | } |
@@ -590,7 +593,7 @@ int recursiveAction(const char *fileName, | |||
590 | return FALSE; | 593 | return FALSE; |
591 | } | 594 | } |
592 | if (dirAction != NULL && depthFirst == FALSE) { | 595 | if (dirAction != NULL && depthFirst == FALSE) { |
593 | status = dirAction(fileName, &statbuf); | 596 | status = dirAction(fileName, &statbuf, userData); |
594 | if (status == FALSE) { | 597 | if (status == FALSE) { |
595 | perror(fileName); | 598 | perror(fileName); |
596 | return FALSE; | 599 | return FALSE; |
@@ -610,7 +613,7 @@ int recursiveAction(const char *fileName, | |||
610 | sprintf(nextFile, "%s/%s", fileName, next->d_name); | 613 | sprintf(nextFile, "%s/%s", fileName, next->d_name); |
611 | status = | 614 | status = |
612 | recursiveAction(nextFile, TRUE, followLinks, depthFirst, | 615 | recursiveAction(nextFile, TRUE, followLinks, depthFirst, |
613 | fileAction, dirAction); | 616 | fileAction, dirAction, userData); |
614 | if (status < 0) { | 617 | if (status < 0) { |
615 | closedir(dir); | 618 | closedir(dir); |
616 | return FALSE; | 619 | return FALSE; |
@@ -622,7 +625,7 @@ int recursiveAction(const char *fileName, | |||
622 | return FALSE; | 625 | return FALSE; |
623 | } | 626 | } |
624 | if (dirAction != NULL && depthFirst == TRUE) { | 627 | if (dirAction != NULL && depthFirst == TRUE) { |
625 | status = dirAction(fileName, &statbuf); | 628 | status = dirAction(fileName, &statbuf, userData); |
626 | if (status == FALSE) { | 629 | if (status == FALSE) { |
627 | perror(fileName); | 630 | perror(fileName); |
628 | return FALSE; | 631 | return FALSE; |
@@ -632,7 +635,7 @@ int recursiveAction(const char *fileName, | |||
632 | if (fileAction == NULL) | 635 | if (fileAction == NULL) |
633 | return TRUE; | 636 | return TRUE; |
634 | else | 637 | else |
635 | return fileAction(fileName, &statbuf); | 638 | return fileAction(fileName, &statbuf, userData); |
636 | } | 639 | } |
637 | return TRUE; | 640 | return TRUE; |
638 | } | 641 | } |
@@ -1514,19 +1517,6 @@ extern int find_real_root_device_name(char* name) | |||
1514 | #endif | 1517 | #endif |
1515 | 1518 | ||
1516 | 1519 | ||
1517 | #if defined BB_MTAB | ||
1518 | #define whine_if_fstab_is_missing() {} | ||
1519 | #else | ||
1520 | extern void whine_if_fstab_is_missing() | ||
1521 | { | ||
1522 | struct stat statBuf; | ||
1523 | |||
1524 | if (stat("/etc/fstab", &statBuf) < 0) | ||
1525 | fprintf(stderr, | ||
1526 | "/etc/fstab file missing -- install one to name /dev/root.\n\n"); | ||
1527 | } | ||
1528 | #endif | ||
1529 | |||
1530 | /* END CODE */ | 1520 | /* END CODE */ |
1531 | /* | 1521 | /* |
1532 | Local Variables: | 1522 | Local Variables: |