diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2011-11-03 10:19:53 +0100 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2011-11-03 10:19:53 +0100 |
commit | f3efd3c2a08feaf6ed35fcadfa4cf131efe5e070 (patch) | |
tree | c4a4ec4727e493ce4499e6f92062144dc92b8557 | |
parent | f808e777db05bed7b3c0a4aa5f12121fb3d0ca5f (diff) | |
download | busybox-w32-f3efd3c2a08feaf6ed35fcadfa4cf131efe5e070.tar.gz busybox-w32-f3efd3c2a08feaf6ed35fcadfa4cf131efe5e070.tar.bz2 busybox-w32-f3efd3c2a08feaf6ed35fcadfa4cf131efe5e070.zip |
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.c | 20 |
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) | |||
108 | } | 108 | } |
109 | } | 109 | } |
110 | /* Write previously received block */ | 110 | /* Write previously received block */ |
111 | if (blockLength) { | 111 | errno = 0; |
112 | errno = 0; | 112 | if (full_write(file_fd, blockBuf, blockLength) != blockLength) { |
113 | if (full_write(file_fd, blockBuf, blockLength) != blockLength) { | 113 | bb_perror_msg(bb_msg_write_error); |
114 | bb_perror_msg("can't write to file"); | 114 | goto fatal; |
115 | goto fatal; | ||
116 | } | ||
117 | } | 115 | } |
118 | 116 | ||
119 | timeout = TIMEOUT; | 117 | timeout = TIMEOUT; |
@@ -155,17 +153,13 @@ static int receive(/*int read_fd, */int file_fd) | |||
155 | blockBuf[i] = cc; | 153 | blockBuf[i] = cc; |
156 | } | 154 | } |
157 | 155 | ||
156 | cksum_or_crc = read_byte(TIMEOUT); | ||
157 | if (cksum_or_crc < 0) | ||
158 | goto timeout; | ||
158 | if (do_crc) { | 159 | if (do_crc) { |
159 | cksum_or_crc = read_byte(TIMEOUT); | ||
160 | if (cksum_or_crc < 0) | ||
161 | goto timeout; | ||
162 | cksum_or_crc = (cksum_or_crc << 8) | read_byte(TIMEOUT); | 160 | cksum_or_crc = (cksum_or_crc << 8) | read_byte(TIMEOUT); |
163 | if (cksum_or_crc < 0) | 161 | if (cksum_or_crc < 0) |
164 | goto timeout; | 162 | goto timeout; |
165 | } else { | ||
166 | cksum_or_crc = read_byte(TIMEOUT); | ||
167 | if (cksum_or_crc < 0) | ||
168 | goto timeout; | ||
169 | } | 163 | } |
170 | 164 | ||
171 | if (blockNo == ((wantBlockNo - 1) & 0xff)) { | 165 | if (blockNo == ((wantBlockNo - 1) & 0xff)) { |