diff options
Diffstat (limited to 'utils/swi-update.c')
-rw-r--r-- | utils/swi-update.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/utils/swi-update.c b/utils/swi-update.c index 86dc546..d046d88 100644 --- a/utils/swi-update.c +++ b/utils/swi-update.c @@ -802,8 +802,7 @@ static int download_image(int serfd, char *buf, const char *image) goto out; } fstat(imgfd, &img_data); - filelen = imglen(type, img_data.st_size) - hdrlen(type); - if (filelen < 0) { + if (imglen(type, img_data.st_size) < hdrlen(type)) { fprintf(stderr, "%s is too short\n", image); ret = -1; goto out; @@ -828,6 +827,7 @@ static int download_image(int serfd, char *buf, const char *image) if (read_and_parse(serfd, false) < 0) goto out; + filelen = imglen(type, img_data.st_size) - hdrlen(type); /* remaining data to send */ while (filelen > 0) { fd_set wr; |