aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatheus Izvekov <mizvekov@gmail.com>2010-01-18 23:34:29 -0200
committerDenys Vlasenko <vda.linux@googlemail.com>2010-01-20 02:46:14 +0100
commit94a6fd1eeb185f8fea5c0906553552fb2a8aa8d0 (patch)
tree74241b70e6a56fcef4f495245b552cf7e7362ac1
parent404f14407c52a994c039dadf7b00df8eb6953d8a (diff)
downloadbusybox-w32-94a6fd1eeb185f8fea5c0906553552fb2a8aa8d0.tar.gz
busybox-w32-94a6fd1eeb185f8fea5c0906553552fb2a8aa8d0.tar.bz2
busybox-w32-94a6fd1eeb185f8fea5c0906553552fb2a8aa8d0.zip
diff: don't exit in case we can't open input files. -2 bytes
>>From d4cf19d20596bca797d58563f4404cf6a4932977 Mon Sep 17 00:00:00 2001 From: Matheus Izvekov <mizvekov@gmail.com> Date: Mon, 18 Jan 2010 23:27:56 -0200 Subject: [PATCH] diff: don't exit in case we can't open input files This prevents recursion being aborted due to failures to open files. Signed-off-by: Matheus Izvekov <mizvekov@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--editors/diff.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/editors/diff.c b/editors/diff.c
index b7a13871a..91109821e 100644
--- a/editors/diff.c
+++ b/editors/diff.c
@@ -671,14 +671,14 @@ static bool diff(FILE* fp[2], char *file[2])
671 671
672static int diffreg(char *file[2]) 672static int diffreg(char *file[2])
673{ 673{
674 FILE *fp[2]; 674 FILE *fp[2] = { stdin, stdin };
675 bool binary = false, differ = false; 675 bool binary = false, differ = false;
676 int status = STATUS_SAME; 676 int status = STATUS_SAME;
677 677
678 for (int i = 0; i < 2; i++) { 678 for (int i = 0; i < 2; i++) {
679 int fd = open_or_warn_stdin(file[i]); 679 int fd = open_or_warn_stdin(file[i]);
680 if (fd == -1) 680 if (fd == -1)
681 xfunc_die(); 681 goto out;
682 /* Our diff implementation is using seek. 682 /* Our diff implementation is using seek.
683 * When we meet non-seekable file, we must make a temp copy. 683 * When we meet non-seekable file, we must make a temp copy.
684 */ 684 */
@@ -725,7 +725,7 @@ static int diffreg(char *file[2])
725 } 725 }
726 if (status != STATUS_SAME) 726 if (status != STATUS_SAME)
727 exit_status |= 1; 727 exit_status |= 1;
728 728out:
729 fclose_if_not_stdin(fp[0]); 729 fclose_if_not_stdin(fp[0]);
730 fclose_if_not_stdin(fp[1]); 730 fclose_if_not_stdin(fp[1]);
731 731