diff options
author | Rob Landley | 2006-07-16 08:14:35 +0000 |
---|---|---|
committer | Rob Landley | 2006-07-16 08:14:35 +0000 |
commit | 534374755d618c9c36c9940c82756241c4b25a67 (patch) | |
tree | fac906b4fa40a68c53cecf20215a7a25b3b1cab6 /libbb/copyfd.c | |
parent | afb94ecf2bb6c53ce2a381d6ce45a426243c76d9 (diff) | |
download | busybox-534374755d618c9c36c9940c82756241c4b25a67.zip busybox-534374755d618c9c36c9940c82756241c4b25a67.tar.gz |
Cleaup read() and write() variants, plus a couple of new functions like
xlseek and fdlength() for the new mkswap.
Diffstat (limited to 'libbb/copyfd.c')
-rw-r--r-- | libbb/copyfd.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/libbb/copyfd.c b/libbb/copyfd.c index e2c542e..0c4f7a0 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) if (src_fd < 0) goto out; while (!size || total < size) { - ssize_t wrote, xread; + ssize_t wr, rd; - xread = safe_read(src_fd, buffer, + rd = safe_read(src_fd, buffer, (!size || size - total > BUFSIZ) ? BUFSIZ : size - total); - if (xread > 0) { + if (rd > 0) { /* A -1 dst_fd means we need to fake it... */ - wrote = (dst_fd < 0) ? xread : bb_full_write(dst_fd, buffer, xread); - if (wrote < xread) { + wr = (dst_fd < 0) ? rd : full_write(dst_fd, buffer, rd); + if (wr < rd) { bb_perror_msg(bb_msg_write_error); break; } - total += wrote; + total += wr; if (total == size) status = 0; - } else if (xread < 0) { + } else if (rd < 0) { bb_perror_msg(bb_msg_read_error); break; - } else if (xread == 0) { + } else if (rd == 0) { /* All done. */ status = 0; break; |