diff options
author | Ron Yorston <rmy@pobox.com> | 2012-09-07 11:48:25 +0100 |
---|---|---|
committer | Ron Yorston <rmy@pobox.com> | 2012-09-07 11:48:25 +0100 |
commit | fecf687cc358883de2da21de33346f0df204c80b (patch) | |
tree | d22c606157926fb659374ae68d55e3a874bacf25 /findutils | |
parent | b25a7c28a0f684087fa6ccbbc7e265a9cac0f0fa (diff) | |
parent | 6d463de46b418e6c4c8d1397033608f78b33ab21 (diff) | |
download | busybox-w32-fecf687cc358883de2da21de33346f0df204c80b.tar.gz busybox-w32-fecf687cc358883de2da21de33346f0df204c80b.tar.bz2 busybox-w32-fecf687cc358883de2da21de33346f0df204c80b.zip |
Merge branch 'busybox' into merge
Conflicts:
include/libbb.h
shell/ash.c
Diffstat (limited to 'findutils')
-rw-r--r-- | findutils/find.c | 45 |
1 files changed, 30 insertions, 15 deletions
diff --git a/findutils/find.c b/findutils/find.c index fc0fc5c9f..b521e5b08 100644 --- a/findutils/find.c +++ b/findutils/find.c | |||
@@ -728,10 +728,27 @@ static int FAST_FUNC fileAction(const char *fileName, | |||
728 | int depth IF_NOT_FEATURE_FIND_MAXDEPTH(UNUSED_PARAM)) | 728 | int depth IF_NOT_FEATURE_FIND_MAXDEPTH(UNUSED_PARAM)) |
729 | { | 729 | { |
730 | int r; | 730 | int r; |
731 | int same_fs = 1; | ||
732 | |||
733 | #if ENABLE_FEATURE_FIND_XDEV | ||
734 | if (S_ISDIR(statbuf->st_mode) && G.xdev_count) { | ||
735 | int i; | ||
736 | for (i = 0; i < G.xdev_count; i++) { | ||
737 | if (G.xdev_dev[i] == statbuf->st_dev) | ||
738 | goto found; | ||
739 | } | ||
740 | //bb_error_msg("'%s': not same fs", fileName); | ||
741 | same_fs = 0; | ||
742 | found: ; | ||
743 | } | ||
744 | #endif | ||
731 | 745 | ||
732 | #if ENABLE_FEATURE_FIND_MAXDEPTH | 746 | #if ENABLE_FEATURE_FIND_MAXDEPTH |
733 | if (depth < G.minmaxdepth[0]) | 747 | if (depth < G.minmaxdepth[0]) { |
734 | return TRUE; /* skip this, continue recursing */ | 748 | if (same_fs) |
749 | return TRUE; /* skip this, continue recursing */ | ||
750 | return SKIP; /* stop recursing */ | ||
751 | } | ||
735 | if (depth > G.minmaxdepth[1]) | 752 | if (depth > G.minmaxdepth[1]) |
736 | return SKIP; /* stop recursing */ | 753 | return SKIP; /* stop recursing */ |
737 | #endif | 754 | #endif |
@@ -747,21 +764,11 @@ static int FAST_FUNC fileAction(const char *fileName, | |||
747 | return SKIP; | 764 | return SKIP; |
748 | } | 765 | } |
749 | #endif | 766 | #endif |
750 | #if ENABLE_FEATURE_FIND_XDEV | ||
751 | /* -xdev stops on mountpoints, but AFTER mountpoit itself | 767 | /* -xdev stops on mountpoints, but AFTER mountpoit itself |
752 | * is processed as usual */ | 768 | * is processed as usual */ |
753 | if (S_ISDIR(statbuf->st_mode)) { | 769 | if (!same_fs) { |
754 | if (G.xdev_count) { | 770 | return SKIP; |
755 | int i; | ||
756 | for (i = 0; i < G.xdev_count; i++) { | ||
757 | if (G.xdev_dev[i] == statbuf->st_dev) | ||
758 | goto found; | ||
759 | } | ||
760 | return SKIP; | ||
761 | found: ; | ||
762 | } | ||
763 | } | 771 | } |
764 | #endif | ||
765 | 772 | ||
766 | /* Cannot return 0: our caller, recursive_action(), | 773 | /* Cannot return 0: our caller, recursive_action(), |
767 | * will perror() and skip dirs (if called on dir) */ | 774 | * will perror() and skip dirs (if called on dir) */ |
@@ -831,6 +838,11 @@ static action*** parse_params(char **argv) | |||
831 | PARM_name , | 838 | PARM_name , |
832 | PARM_iname , | 839 | PARM_iname , |
833 | IF_FEATURE_FIND_PATH( PARM_path ,) | 840 | IF_FEATURE_FIND_PATH( PARM_path ,) |
841 | #if ENABLE_DESKTOP | ||
842 | /* -wholename is a synonym for -path */ | ||
843 | /* We support it because Linux kernel's "make tags" uses it */ | ||
844 | IF_FEATURE_FIND_PATH( PARM_wholename ,) | ||
845 | #endif | ||
834 | IF_FEATURE_FIND_PATH( PARM_ipath ,) | 846 | IF_FEATURE_FIND_PATH( PARM_ipath ,) |
835 | IF_FEATURE_FIND_REGEX( PARM_regex ,) | 847 | IF_FEATURE_FIND_REGEX( PARM_regex ,) |
836 | IF_FEATURE_FIND_TYPE( PARM_type ,) | 848 | IF_FEATURE_FIND_TYPE( PARM_type ,) |
@@ -869,6 +881,9 @@ static action*** parse_params(char **argv) | |||
869 | "-name\0" | 881 | "-name\0" |
870 | "-iname\0" | 882 | "-iname\0" |
871 | IF_FEATURE_FIND_PATH( "-path\0" ) | 883 | IF_FEATURE_FIND_PATH( "-path\0" ) |
884 | #if ENABLE_DESKTOP | ||
885 | IF_FEATURE_FIND_PATH( "-wholename\0") | ||
886 | #endif | ||
872 | IF_FEATURE_FIND_PATH( "-ipath\0" ) | 887 | IF_FEATURE_FIND_PATH( "-ipath\0" ) |
873 | IF_FEATURE_FIND_REGEX( "-regex\0" ) | 888 | IF_FEATURE_FIND_REGEX( "-regex\0" ) |
874 | IF_FEATURE_FIND_TYPE( "-type\0" ) | 889 | IF_FEATURE_FIND_TYPE( "-type\0" ) |
@@ -1076,7 +1091,7 @@ static action*** parse_params(char **argv) | |||
1076 | ap->iname = (parm == PARM_iname); | 1091 | ap->iname = (parm == PARM_iname); |
1077 | } | 1092 | } |
1078 | #if ENABLE_FEATURE_FIND_PATH | 1093 | #if ENABLE_FEATURE_FIND_PATH |
1079 | else if (parm == PARM_path || parm == PARM_ipath) { | 1094 | else if (parm == PARM_path IF_DESKTOP(|| parm == PARM_wholename) || parm == PARM_ipath) { |
1080 | action_path *ap; | 1095 | action_path *ap; |
1081 | dbg("%d", __LINE__); | 1096 | dbg("%d", __LINE__); |
1082 | ap = ALLOC_ACTION(path); | 1097 | ap = ALLOC_ACTION(path); |