aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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)
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)) {