From fcfb7ad05ffd9b3a8f50cbd2a54024258cb2218c Mon Sep 17 00:00:00 2001 From: Bjorn Andersson Date: Fri, 30 Nov 2018 11:02:14 -0800 Subject: [PATCH] fastboot: Don't tear down link when fastboot download fails There are cases where fastboot simply disconnects, where it makes sense to maintain the cdba connection, so return gracefully from fastboot_download() when this happens. Signed-off-by: Bjorn Andersson --- fastboot.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/fastboot.c b/fastboot.c index 2a97205..ba6dba9 100644 --- a/fastboot.c +++ b/fastboot.c @@ -375,8 +375,10 @@ int fastboot_download(struct fastboot *fb, const void *data, size_t len) fastboot_write(fb, cmd, n); n = fastboot_read(fb, buf, MAX_USBFS_BULK_SIZE); - if (n < 0) - errx(1, "remote rejected download request"); + if (n < 0) { + fprintf(stderr, "remote rejected download request\n"); + return -1; + } while (len > 0) { xfer = MIN(len, MAX_USBFS_BULK_SIZE);