From bbd889f13f94d59a5b78f3c3bc93499d523b8264 Mon Sep 17 00:00:00 2001 From: David Timber Date: Tue, 10 Aug 2021 19:43:33 +1000 Subject: Impl M2M binary update ... * Use getopt in proone-bne * Call pth_yield() where necessary * htbt: truncate downloaded binary if actual size of data transfered is less than alloc_len * prne_rcb_param.self is not optional as proone-bne uses nybin * Add --vercmp option for proone-bne to test M2M bin update * Refactor proone-htbtclient * Protocol change: prne_htbt_bin_meta.alloc_len is now size_t * Add convenience functions: prne_realloc_str(), prne_redup_str() --- src/proone-htbtclient.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) (limited to 'src/proone-htbtclient.c') diff --git a/src/proone-htbtclient.c b/src/proone-htbtclient.c index 534719d..533330f 100644 --- a/src/proone-htbtclient.c +++ b/src/proone-htbtclient.c @@ -560,7 +560,7 @@ static int parse_args_hover (const int argc, char *const *args) { } } else { - break; + return 2; } } @@ -1983,12 +1983,9 @@ static bool run_setup (const uint16_t msgid) { goto END; } - if (fs.st_size < PRNE_HTBT_BIN_ALLOC_LEN_MAX) { - prog_conf.cmd_param.run.bm.alloc_len = (uint32_t)fs.st_size; - } - else { - prog_conf.cmd_param.run.bm.alloc_len = PRNE_HTBT_BIN_ALLOC_LEN_MAX; - } + prog_conf.cmd_param.run.bm.alloc_len = prne_op_min( + fs.st_size, + PRNE_HTBT_BIN_ALLOC_LEN_MAX); f = &prog_conf.cmd_param.run.bm; ser_f = (prne_htbt_ser_ft)prne_htbt_ser_bin_meta; break; -- cgit