summaryrefslogtreecommitdiff
path: root/editors
diff options
context:
space:
mode:
authorDenys Vlasenko2015-01-11 16:41:54 +0100
committerDenys Vlasenko2015-01-11 16:41:54 +0100
commit39f017293a047ac1063c84263d4d855b86c62ba1 (patch)
tree688381313ce2ba8db50ee58e8d5007462fa9e9c4 /editors
parent70f4320b40b7af83525cebabab2bc437a22c41d2 (diff)
downloadbusybox-39f017293a047ac1063c84263d4d855b86c62ba1.zip
busybox-39f017293a047ac1063c84263d4d855b86c62ba1.tar.gz
diff: fix a bug in diffing against stdin. Closes 7784
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'editors')
-rw-r--r--editors/diff.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/editors/diff.c b/editors/diff.c
index a78a0ee..c3ad31b 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");
}