summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2011-11-03 10:19:53 +0100
committerDenys Vlasenko <vda.linux@googlemail.com>2011-11-03 10:19:53 +0100
commitf3efd3c2a08feaf6ed35fcadfa4cf131efe5e070 (patch)
treec4a4ec4727e493ce4499e6f92062144dc92b8557
parentf808e777db05bed7b3c0a4aa5f12121fb3d0ca5f (diff)
rx: code shrink
function old new delta rx_main 961 947 -14 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--miscutils/rx.c20
1 files changed, 7 insertions, 13 deletions
diff --git a/miscutils/rx.c b/miscutils/rx.c
index 972f7ff37..c48a61fd0 100644
--- a/miscutils/rx.c
+++ b/miscutils/rx.c
@@ -108,12 +108,10 @@ static int receive(/*int read_fd, */int file_fd)
}
}
/* Write previously received block */
- if (blockLength) {
- errno = 0;
- if (full_write(file_fd, blockBuf, blockLength) != blockLength) {
- bb_perror_msg("can't write to file");
- goto fatal;
- }
+ errno = 0;
+ if (full_write(file_fd, blockBuf, blockLength) != blockLength) {
+ bb_perror_msg(bb_msg_write_error);
+ goto fatal;
}
timeout = TIMEOUT;
@@ -155,17 +153,13 @@ static int receive(/*int read_fd, */int file_fd)
blockBuf[i] = cc;
}
+ cksum_or_crc = read_byte(TIMEOUT);
+ if (cksum_or_crc < 0)
+ goto timeout;
if (do_crc) {
- cksum_or_crc = read_byte(TIMEOUT);
- if (cksum_or_crc < 0)
- goto timeout;
cksum_or_crc = (cksum_or_crc << 8) | read_byte(TIMEOUT);
if (cksum_or_crc < 0)
goto timeout;
- } else {
- cksum_or_crc = read_byte(TIMEOUT);
- if (cksum_or_crc < 0)
- goto timeout;
}
if (blockNo == ((wantBlockNo - 1) & 0xff)) {