From 39f017293a047ac1063c84263d4d855b86c62ba1 Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Sun, 11 Jan 2015 16:41:54 +0100 Subject: diff: fix a bug in diffing against stdin. Closes 7784 Signed-off-by: Denys Vlasenko --- editors/diff.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'editors') diff --git a/editors/diff.c b/editors/diff.c index a78a0ee28..c3ad31bf3 100644 --- a/editors/diff.c +++ b/editors/diff.c @@ -740,9 +740,10 @@ static int diffreg(char *file[2]) unlink(name); if (bb_copyfd_eof(fd, fd_tmp) < 0) xfunc_die(); - if (fd) /* Prevents closing of stdin */ + if (fd != STDIN_FILENO) close(fd); fd = fd_tmp; + xlseek(fd, 0, SEEK_SET); } fp[i] = fdopen(fd, "r"); } -- cgit v1.2.3