[PATCH 04/19] fastboot: don't close fd 0 when downloading to ram

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Daniel Glöckner <dg@xxxxxxxxx>

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 <dg@xxxxxxxxx>
Signed-off-by: Sascha Hauer <s.hauer@xxxxxxxxxxxxxx>
---
 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
barebox@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/barebox




[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux