[git commit master] diff: don't exit in case we can't open input files. -2 bytes
Denys Vlasenko
vda.linux at googlemail.com
Wed Jan 20 01:46:39 UTC 2010
commit: http://git.busybox.net/busybox/commit/?id=94a6fd1eeb185f8fea5c0906553552fb2a8aa8d0
branch: http://git.busybox.net/busybox/commit/?id=refs/heads/master
>>From d4cf19d20596bca797d58563f4404cf6a4932977 Mon Sep 17 00:00:00 2001
From: Denys Vlasenko <vda.linux at googlemail.com>
Date: Wed, 20 Jan 2010 02:46:39 +0100
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 at gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux at googlemail.com>
---
editors/diff.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/editors/diff.c b/editors/diff.c
index b7a1387..9110982 100644
--- a/editors/diff.c
+++ b/editors/diff.c
@@ -671,14 +671,14 @@ static bool diff(FILE* fp[2], char *file[2])
static int diffreg(char *file[2])
{
- FILE *fp[2];
+ FILE *fp[2] = { stdin, stdin };
bool binary = false, differ = false;
int status = STATUS_SAME;
for (int i = 0; i < 2; i++) {
int fd = open_or_warn_stdin(file[i]);
if (fd == -1)
- xfunc_die();
+ goto out;
/* Our diff implementation is using seek.
* When we meet non-seekable file, we must make a temp copy.
*/
@@ -725,7 +725,7 @@ static int diffreg(char *file[2])
}
if (status != STATUS_SAME)
exit_status |= 1;
-
+out:
fclose_if_not_stdin(fp[0]);
fclose_if_not_stdin(fp[1]);
--
1.6.3.3
More information about the busybox-cvs
mailing list