aboutsummaryrefslogtreecommitdiff
path: root/libbb/copyfd.c
diff options
context:
space:
mode:
Diffstat (limited to 'libbb/copyfd.c')
-rw-r--r--libbb/copyfd.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/libbb/copyfd.c b/libbb/copyfd.c
index e2c542e32..0c4f7a054 100644
--- a/libbb/copyfd.c
+++ b/libbb/copyfd.c
@@ -30,24 +30,24 @@ static ssize_t bb_full_fd_action(int src_fd, int dst_fd, size_t size)
30 if (src_fd < 0) goto out; 30 if (src_fd < 0) goto out;
31 while (!size || total < size) 31 while (!size || total < size)
32 { 32 {
33 ssize_t wrote, xread; 33 ssize_t wr, rd;
34 34
35 xread = safe_read(src_fd, buffer, 35 rd = safe_read(src_fd, buffer,
36 (!size || size - total > BUFSIZ) ? BUFSIZ : size - total); 36 (!size || size - total > BUFSIZ) ? BUFSIZ : size - total);
37 37
38 if (xread > 0) { 38 if (rd > 0) {
39 /* A -1 dst_fd means we need to fake it... */ 39 /* A -1 dst_fd means we need to fake it... */
40 wrote = (dst_fd < 0) ? xread : bb_full_write(dst_fd, buffer, xread); 40 wr = (dst_fd < 0) ? rd : full_write(dst_fd, buffer, rd);
41 if (wrote < xread) { 41 if (wr < rd) {
42 bb_perror_msg(bb_msg_write_error); 42 bb_perror_msg(bb_msg_write_error);
43 break; 43 break;
44 } 44 }
45 total += wrote; 45 total += wr;
46 if (total == size) status = 0; 46 if (total == size) status = 0;
47 } else if (xread < 0) { 47 } else if (rd < 0) {
48 bb_perror_msg(bb_msg_read_error); 48 bb_perror_msg(bb_msg_read_error);
49 break; 49 break;
50 } else if (xread == 0) { 50 } else if (rd == 0) {
51 /* All done. */ 51 /* All done. */
52 status = 0; 52 status = 0;
53 break; 53 break;