[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 2/2] microvm: check g_file_set_contents() return value
From: |
Gerd Hoffmann |
Subject: |
[PATCH 2/2] microvm: check g_file_set_contents() return value |
Date: |
Mon, 8 Nov 2021 14:07:18 +0100 |
Fixes: CID 1465239
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
hw/i386/microvm-dt.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/hw/i386/microvm-dt.c b/hw/i386/microvm-dt.c
index ad4e48e5fe60..774e0bc7fef3 100644
--- a/hw/i386/microvm-dt.c
+++ b/hw/i386/microvm-dt.c
@@ -334,7 +334,10 @@ void dt_setup_microvm(MicrovmMachineState *mms)
if (debug) {
fprintf(stderr, "%s: writing microvm.fdt\n", __func__);
- g_file_set_contents("microvm.fdt", mms->fdt, size, NULL);
+ if (!g_file_set_contents("microvm.fdt", mms->fdt, size, NULL)) {
+ fprintf(stderr, "%s: writing microvm.fdt failed\n", __func__);
+ return;
+ }
int ret = system("dtc -I dtb -O dts microvm.fdt");
if (ret != 0) {
fprintf(stderr, "%s: oops, dtc not installed?\n", __func__);
--
2.31.1