From: Daniel Glöckner <[email protected]>

When downloading to a buffer, download_fd is never assigned a valid file
descriptor. We should therefore avoid calling close on the value found
in that variable.

Signed-off-by: Daniel Glöckner <[email protected]>
Signed-off-by: Sascha Hauer <[email protected]>
---
 common/fastboot.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/common/fastboot.c b/common/fastboot.c
index d58f68f1bb..1e12f99915 100644
--- a/common/fastboot.c
+++ b/common/fastboot.c
@@ -342,7 +342,8 @@ int fastboot_handle_download_data(struct fastboot *fb, 
const void *buffer,
 
 void fastboot_download_finished(struct fastboot *fb)
 {
-       close(fb->download_fd);
+       if (!fastboot_download_to_buf(fb))
+               close(fb->download_fd);
 
        printf("\n");
 
-- 
2.26.2


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox

Reply via email to