* [Qemu-devel] [PATCH] vl: Improve error message when we can't load fw_cfg from file
@ 2018-11-01 5:59 Li Qiang
2018-11-15 12:20 ` Li Qiang
2018-11-21 17:52 ` Paolo Bonzini
0 siblings, 2 replies; 3+ messages in thread
From: Li Qiang @ 2018-11-01 5:59 UTC (permalink / raw)
To: pbonzini, armbru, philmd; +Cc: qemu-devel, Li Qiang
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 <liq3ea@gmail.com>
---
vl.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/vl.c b/vl.c
index 1fcacc5..f0bd899 100644
--- a/vl.c
+++ b/vl.c
@@ -2244,8 +2244,10 @@ static int parse_fw_cfg(void *opaque, QemuOpts *opts, Error **errp)
size = strlen(str); /* NUL terminator NOT included in fw_cfg blob */
buf = g_memdup(str, size);
} else {
- if (!g_file_get_contents(file, &buf, &size, NULL)) {
- error_setg(errp, "can't load %s", file);
+ GError *err = NULL;
+ if (!g_file_get_contents(file, &buf, &size, &err)) {
+ error_setg(errp, "can't load %s: %s", file, err->message);
+ g_error_free(err);
return -1;
}
}
--
1.8.3.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PATCH] vl: Improve error message when we can't load fw_cfg from file
2018-11-01 5:59 [Qemu-devel] [PATCH] vl: Improve error message when we can't load fw_cfg from file Li Qiang
@ 2018-11-15 12:20 ` Li Qiang
2018-11-21 17:52 ` Paolo Bonzini
1 sibling, 0 replies; 3+ messages in thread
From: Li Qiang @ 2018-11-15 12:20 UTC (permalink / raw)
To: Paolo Bonzini, Markus Armbruster, philmd; +Cc: Qemu Developers
Ping....
Li Qiang <liq3ea@gmail.com> 于2018年11月1日周四 下午1:59写道:
> 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 <liq3ea@gmail.com>
> ---
> vl.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/vl.c b/vl.c
> index 1fcacc5..f0bd899 100644
> --- a/vl.c
> +++ b/vl.c
> @@ -2244,8 +2244,10 @@ static int parse_fw_cfg(void *opaque, QemuOpts
> *opts, Error **errp)
> size = strlen(str); /* NUL terminator NOT included in fw_cfg blob
> */
> buf = g_memdup(str, size);
> } else {
> - if (!g_file_get_contents(file, &buf, &size, NULL)) {
> - error_setg(errp, "can't load %s", file);
> + GError *err = NULL;
> + if (!g_file_get_contents(file, &buf, &size, &err)) {
> + error_setg(errp, "can't load %s: %s", file, err->message);
> + g_error_free(err);
> return -1;
> }
> }
> --
> 1.8.3.1
>
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PATCH] vl: Improve error message when we can't load fw_cfg from file
2018-11-01 5:59 [Qemu-devel] [PATCH] vl: Improve error message when we can't load fw_cfg from file Li Qiang
2018-11-15 12:20 ` Li Qiang
@ 2018-11-21 17:52 ` Paolo Bonzini
1 sibling, 0 replies; 3+ messages in thread
From: Paolo Bonzini @ 2018-11-21 17:52 UTC (permalink / raw)
To: Li Qiang, armbru, philmd; +Cc: qemu-devel
On 01/11/18 06:59, Li Qiang wrote:
> 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 <liq3ea@gmail.com>
> ---
> vl.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/vl.c b/vl.c
> index 1fcacc5..f0bd899 100644
> --- a/vl.c
> +++ b/vl.c
> @@ -2244,8 +2244,10 @@ static int parse_fw_cfg(void *opaque, QemuOpts *opts, Error **errp)
> size = strlen(str); /* NUL terminator NOT included in fw_cfg blob */
> buf = g_memdup(str, size);
> } else {
> - if (!g_file_get_contents(file, &buf, &size, NULL)) {
> - error_setg(errp, "can't load %s", file);
> + GError *err = NULL;
> + if (!g_file_get_contents(file, &buf, &size, &err)) {
> + error_setg(errp, "can't load %s: %s", file, err->message);
> + g_error_free(err);
> return -1;
> }
> }
>
Queued, thanks.
Paolo
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-11-21 17:52 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-01 5:59 [Qemu-devel] [PATCH] vl: Improve error message when we can't load fw_cfg from file Li Qiang
2018-11-15 12:20 ` Li Qiang
2018-11-21 17:52 ` Paolo Bonzini
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.