diff mbox series

[3/3] raw_handler: Check for openfileoutput() failure

Message ID 20210724150714.567177-3-festevam@gmail.com
State Accepted
Headers show
Series None | expand

Commit Message

Fabio Estevam July 24, 2021, 3:07 p.m. UTC
openfileoutput() may fail, so check its return value and propagate
it in the case of failure.

Signed-off-by: Fabio Estevam <festevam@gmail.com>
---
 handlers/raw_handler.c | 2 ++
 1 file changed, 2 insertions(+)
diff mbox series

Patch

diff --git a/handlers/raw_handler.c b/handlers/raw_handler.c
index 293af7b8140e..7ce95a6b5776 100644
--- a/handlers/raw_handler.c
+++ b/handlers/raw_handler.c
@@ -253,6 +253,8 @@  static int install_raw_file(struct img_type *img,
 	}
 
 	fdout = openfileoutput(path);
+	if (fdout < 0)
+		return fdout;
 	if (!img_check_free_space(img, fdout)) {
 		return -ENOSPC;
 	}