Skip to content

Commit 353c7d5

Browse files
Li Qiangbonzini
Li Qiang
authored andcommitted
vl: Improve error message when we can't load fw_cfg from file
parse_fw_cfg() reports "can't load" without further details. Get the details from g_file_get_contents(), and include them in the error message. Signed-off-by: Li Qiang <[email protected]> Message-Id: <[email protected]> Signed-off-by: Paolo Bonzini <[email protected]>
1 parent 03fee66 commit 353c7d5

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

vl.c

+4-2
Original file line numberDiff line numberDiff line change
@@ -2250,8 +2250,10 @@ static int parse_fw_cfg(void *opaque, QemuOpts *opts, Error **errp)
22502250
size = strlen(str); /* NUL terminator NOT included in fw_cfg blob */
22512251
buf = g_memdup(str, size);
22522252
} else {
2253-
if (!g_file_get_contents(file, &buf, &size, NULL)) {
2254-
error_setg(errp, "can't load %s", file);
2253+
GError *err = NULL;
2254+
if (!g_file_get_contents(file, &buf, &size, &err)) {
2255+
error_setg(errp, "can't load %s: %s", file, err->message);
2256+
g_error_free(err);
22552257
return -1;
22562258
}
22572259
}

0 commit comments

Comments
 (0)