aboutsummaryrefslogtreecommitdiff
path: root/libbb
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2019-10-11 14:11:44 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2019-10-11 14:11:44 +0200
commit42f454b13b8d972e85acd7f046065ec69af4d206 (patch)
tree2cc09f3970a5115bee0fccda3c558a1e9211660f /libbb
parent7011eca83afc313098f9869eea36742d4506bc02 (diff)
downloadbusybox-42f454b13b8d972e85acd7f046065ec69af4d206.tar.gz
dpkg-deb: work around bogus error message when working with XZ compressed packages
function old new delta unpack_xz_stream 2309 2317 +8 bb_full_fd_action 464 472 +8 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'libbb')
-rw-r--r--libbb/copyfd.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/libbb/copyfd.c b/libbb/copyfd.c
index ae5c26999..d41fd10f0 100644
--- a/libbb/copyfd.c
+++ b/libbb/copyfd.c
@@ -18,7 +18,7 @@
* was seen to cause largish delays when user tries to ^C a file copy.
* Let's use a saner size.
* Note: needs to be >= max(CONFIG_FEATURE_COPYBUF_KB),
- * or else "copy to eof" code will use neddlesly short reads.
+ * or else "copy to eof" code will use needlesly short reads.
*/
#define SENDFILE_BIGBUF (16*1024*1024)
@@ -60,10 +60,13 @@ static off_t bb_full_fd_action(int src_fd, int dst_fd, off_t size)
ssize_t rd;
if (sendfile_sz) {
- rd = sendfile(dst_fd, src_fd, NULL,
- size > sendfile_sz ? sendfile_sz : size);
- if (rd >= 0)
- goto read_ok;
+ /* dst_fd == -1 is a fake, else... */
+ if (dst_fd >= 0) {
+ rd = sendfile(dst_fd, src_fd, NULL,
+ size > sendfile_sz ? sendfile_sz : size);
+ if (rd >= 0)
+ goto read_ok;
+ }
sendfile_sz = 0; /* do not try sendfile anymore */
}
#if CONFIG_FEATURE_COPYBUF_KB > 4