diff options
author | Alexander Shishkin <virtuoso@slind.org> | 2011-01-25 18:03:46 +0200 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2011-01-26 01:09:12 +0100 |
commit | f18a82d9b320146e367217aba6664b1efb1be68c (patch) | |
tree | efc0fbe0b51877df6254e873322333b434ae1416 | |
parent | 8d0e0cdadf726beab28ccdc7d69738c1534e1f74 (diff) | |
download | busybox-w32-f18a82d9b320146e367217aba6664b1efb1be68c.tar.gz busybox-w32-f18a82d9b320146e367217aba6664b1efb1be68c.tar.bz2 busybox-w32-f18a82d9b320146e367217aba6664b1efb1be68c.zip |
diff: return 1 when skipping directories with -r, but without -N
Diff in diffutils will return 1 in case -r option is specified without
-N something exists only in one of the directories.
Signed-off-by: Alexander Shishkin <virtuoso@slind.org>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r-- | editors/diff.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/editors/diff.c b/editors/diff.c index cc7ba472e..ca4a4eae7 100644 --- a/editors/diff.c +++ b/editors/diff.c | |||
@@ -794,7 +794,9 @@ static int FAST_FUNC skip_dir(const char *filename, | |||
794 | free(othername); | 794 | free(othername); |
795 | if (r != 0 || !S_ISDIR(osb.st_mode)) { | 795 | if (r != 0 || !S_ISDIR(osb.st_mode)) { |
796 | /* other dir doesn't have similarly named | 796 | /* other dir doesn't have similarly named |
797 | * directory, don't recurse */ | 797 | * directory, don't recurse; return 1 upon |
798 | * exit, just like diffutils' diff */ | ||
799 | exit_status |= 1; | ||
798 | return SKIP; | 800 | return SKIP; |
799 | } | 801 | } |
800 | } | 802 | } |
@@ -846,9 +848,10 @@ static void diffdir(char *p[2], const char *s_start) | |||
846 | break; | 848 | break; |
847 | pos = !dp[0] ? 1 : (!dp[1] ? -1 : strcmp(dp[0], dp[1])); | 849 | pos = !dp[0] ? 1 : (!dp[1] ? -1 : strcmp(dp[0], dp[1])); |
848 | k = pos > 0; | 850 | k = pos > 0; |
849 | if (pos && !(option_mask32 & FLAG(N))) | 851 | if (pos && !(option_mask32 & FLAG(N))) { |
850 | printf("Only in %s: %s\n", p[k], dp[k]); | 852 | printf("Only in %s: %s\n", p[k], dp[k]); |
851 | else { | 853 | exit_status |= 1; |
854 | } else { | ||
852 | char *fullpath[2], *path[2]; /* if -N */ | 855 | char *fullpath[2], *path[2]; /* if -N */ |
853 | 856 | ||
854 | for (i = 0; i < 2; i++) { | 857 | for (i = 0; i < 2; i++) { |