rx: code shrink
function old new delta rx_main 961 947 -14 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
parent
f808e777db
commit
f3efd3c2a0
@ -108,12 +108,10 @@ static int receive(/*int read_fd, */int file_fd)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* Write previously received block */
|
/* Write previously received block */
|
||||||
if (blockLength) {
|
errno = 0;
|
||||||
errno = 0;
|
if (full_write(file_fd, blockBuf, blockLength) != blockLength) {
|
||||||
if (full_write(file_fd, blockBuf, blockLength) != blockLength) {
|
bb_perror_msg(bb_msg_write_error);
|
||||||
bb_perror_msg("can't write to file");
|
goto fatal;
|
||||||
goto fatal;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
timeout = TIMEOUT;
|
timeout = TIMEOUT;
|
||||||
@ -155,17 +153,13 @@ static int receive(/*int read_fd, */int file_fd)
|
|||||||
blockBuf[i] = cc;
|
blockBuf[i] = cc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cksum_or_crc = read_byte(TIMEOUT);
|
||||||
|
if (cksum_or_crc < 0)
|
||||||
|
goto timeout;
|
||||||
if (do_crc) {
|
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);
|
cksum_or_crc = (cksum_or_crc << 8) | read_byte(TIMEOUT);
|
||||||
if (cksum_or_crc < 0)
|
if (cksum_or_crc < 0)
|
||||||
goto timeout;
|
goto timeout;
|
||||||
} else {
|
|
||||||
cksum_or_crc = read_byte(TIMEOUT);
|
|
||||||
if (cksum_or_crc < 0)
|
|
||||||
goto timeout;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (blockNo == ((wantBlockNo - 1) & 0xff)) {
|
if (blockNo == ((wantBlockNo - 1) & 0xff)) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user