summaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
authorDaniel Glöckner <dg@emlix.com>2020-05-14 20:21:58 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2020-05-20 15:43:59 +0200
commitc5946e53431bb2aad1ec2a8dc1517955153e56ef (patch)
tree81afeab829f34d81fc6f6daed893e068ec5b3f7b /common
parent2879373370eb3685cd6622f5d800e9f72ec81df1 (diff)
downloadbarebox-c5946e53431bb2aad1ec2a8dc1517955153e56ef.tar.gz
barebox-c5946e53431bb2aad1ec2a8dc1517955153e56ef.tar.xz
fastboot: don't close fd 0 when downloading to ram
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@emlix.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'common')
-rw-r--r--common/fastboot.c3
1 files changed, 2 insertions, 1 deletions
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");