From 534374755d618c9c36c9940c82756241c4b25a67 Mon Sep 17 00:00:00 2001 From: Rob Landley Date: Sun, 16 Jul 2006 08:14:35 +0000 Subject: Cleaup read() and write() variants, plus a couple of new functions like xlseek and fdlength() for the new mkswap. --- libbb/copyfd.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'libbb/copyfd.c') 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) 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; -- cgit v1.2.3