diff --git a/tools/kwboot.c b/tools/kwboot.c index 5d7cb7a774f2ec3b54118583ed22b0273ce0acc2..16c5a84825694f2b39e30e918e630610125f3329 100644 --- a/tools/kwboot.c +++ b/tools/kwboot.c @@ -925,7 +925,7 @@ kwboot_xm_sendblock(int fd, struct kwboot_block *block, int allow_non_xm, *done_print = 0; - retries = 16; + retries = 0; do { rc = kwboot_tty_send(fd, block, sizeof(*block)); if (rc) @@ -944,7 +944,7 @@ kwboot_xm_sendblock(int fd, struct kwboot_block *block, int allow_non_xm, if (!allow_non_xm && c != ACK) kwboot_progress(-1, '+'); - } while (c == NAK && retries-- > 0); + } while (c == NAK && retries++ < 16); if (non_xm_print) kwboot_printv("\n"); @@ -973,7 +973,7 @@ kwboot_xm_finish(int fd) kwboot_printv("Finishing transfer\n"); - retries = 16; + retries = 0; do { rc = kwboot_tty_send_char(fd, EOT); if (rc) @@ -982,7 +982,7 @@ kwboot_xm_finish(int fd) rc = kwboot_xm_recv_reply(fd, &c, 0, NULL, 0, NULL); if (rc) return rc; - } while (c == NAK && retries-- > 0); + } while (c == NAK && retries++ < 16); return _xm_reply_to_error(c); }