summaryrefslogtreecommitdiffstats
path: root/ax25
diff options
context:
space:
mode:
authorThomas Osterried <ax25@x-berg.in-berlin.de>2016-02-12 14:35:05 +0100
committerThomas Osterried <ax25@x-berg.in-berlin.de>2016-02-12 14:35:05 +0100
commitec4368814f892e9c9bce03ec027305e0817861b0 (patch)
treeb94c936194a68caa26277da61f6c79e98470cdcf /ax25
parentfdaffb2aa5ad3d686ed06d4c9289d75d256d9f18 (diff)
Fixed regression in axgetput (bget/bput crc was calculated wrong)
Signed-off-by: Thomas Osterried <ax25@x-berg.in-berlin.de>
Diffstat (limited to 'ax25')
-rw-r--r--ax25/axgetput/proto_bin.c54
1 files changed, 27 insertions, 27 deletions
diff --git a/ax25/axgetput/proto_bin.c b/ax25/axgetput/proto_bin.c
index 5d1bde9..32fb227 100644
--- a/ax25/axgetput/proto_bin.c
+++ b/ax25/axgetput/proto_bin.c
@@ -206,7 +206,7 @@ int bput(void)
}
if (msg_crc)
- crc = calc_crc(buf, len, 0);
+ crc = calc_crc(buf, len, crc);
if (buf[len-1] == '\r') {
if (last_line_had_CR) {
@@ -336,7 +336,7 @@ int bget(void) {
/* compute crc */
while ((len = read(fddata, buf, BLOCKSIZ)) > 0) {
- crc = calc_crc(buf, len, 0);
+ crc = calc_crc(buf, len, crc);
file_size += len;
}
if (len < 0) {
@@ -351,33 +351,33 @@ int bget(void) {
return 1;
}
sprintf(buf, "\r#BIN#%ld#|%d#$%s#%s\r", file_size, crc, unix_to_sfbin_date_string(file_time), get_fixed_filename(filename, file_size, crc, 1));
- } else {
- file_time = time(0);
- if (!is_stream || do_crc_only) {
- sprintf(err_msg, "error: not enough memory\n");
- while ((len = read(fddata, buf, sizeof(buf))) > 0) {
- crc = calc_crc(buf, len, 0);
- file_size += len;
- if (!do_crc_only)
- store_line(buf, len);
- }
- if (len < 0) {
- sprintf(err_msg, "error: read failed (%s)\n", strerror(errno));
- close(fddata);
- return 1;
- }
- *err_msg = 0;
- sprintf(buf, "\r#BIN#%ld#|%d#$%s#%s\r", file_size, crc, unix_to_sfbin_date_string(file_time), get_fixed_filename(filename, file_size, crc, 1));
- } else {
- sprintf(buf, "\r#BIN###$%s#%s\r", unix_to_sfbin_date_string(file_time), get_fixed_filename(filename, 0, 0, 1));
+ } else {
+ file_time = time(0);
+ if (!is_stream || do_crc_only) {
+ sprintf(err_msg, "error: not enough memory\n");
+ while ((len = read(fddata, buf, sizeof(buf))) > 0) {
+ crc = calc_crc(buf, len, crc);
+ file_size += len;
+ if (!do_crc_only)
+ store_line(buf, len);
+ }
+ if (len < 0) {
+ sprintf(err_msg, "error: read failed (%s)\n", strerror(errno));
+ close(fddata);
+ return 1;
}
- /*
- * hack: check for #ABORT# from fdout (fd 1), because fddata (fd 0) is
- * our pipe we read the data from, which we actually tx.
- * believe me, it does work.
- */
- fdin = fdout;
+ *err_msg = 0;
+ sprintf(buf, "\r#BIN#%ld#|%d#$%s#%s\r", file_size, crc, unix_to_sfbin_date_string(file_time), get_fixed_filename(filename, file_size, crc, 1));
+ } else {
+ sprintf(buf, "\r#BIN###$%s#%s\r", unix_to_sfbin_date_string(file_time), get_fixed_filename(filename, 0, 0, 1));
}
+ /*
+ * hack: check for #ABORT# from fdout (fd 1), because fddata (fd 0) is
+ * our pipe we read the data from, which we actually tx.
+ * believe me, it does work.
+ */
+ fdin = fdout;
+ }
if (do_crc_only) {
printf("File information for %s:\n", get_fixed_filename(filename, file_size, crc, 1));