vl.c: print error message if load fw_cfg file failed
PATCH v2 1/1 vl.c: print error message if load fw_cfg file failed
It makes sense to print the error message while reading file failed.
Change since v1:
free error
--- vl.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
vl.c +4 -2
@@ -2207,8 +2207,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_report ("can't load %s" , file); +GError *error =NULL ; +if (!g_file_get_contents (file, &buf, &size, &error)) { +error_report ("can't load %s, %s" , file, error->message); +g_error_free (error);return -1 ; } }
Signature · 1 line
1.8.3.1
Hi Li,
Quoted 2 lines · Li Qiang
It makes sense to print the error message while reading file failed.
OK
Quoted 3 lines
Change since v1:
free error
Changes are useful for reviewer, but not in the git history. You can have them automatically stripped if you place them below the next '---' separator.
Hopefully the maintainer taking this patch can clean this up.
Quoted 4 lines
Signed-off-by Li Qiang <[email protected]>Reviewed-by Philippe Mathieu-Daudé <[email protected]>---
Here goes comment not worth to stay forever in git history:
Since v1: ...
Quoted 8 lines
vl.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)vl.c +0
-0
vl.c static int parse_fw_cfg(void *opaque, QemuOpts *opts, Error **errp) · line 2212
Quoted 8 lines
vl.c +3
-2@@ -2207,8 +2207,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_report ("can't load %s" , file); +GError *error =NULL ; +if (!g_file_get_contents (file, &buf, &size, &error)) { +error_report ("can't load %s, %s" , file, error->message);
If you ever respin, you can help Markus [1] effort using:
error_setg(errp, "can't load %s, %s", file, error->message);
Else your patch will clash with [2].
vl.c static int parse_fw_cfg(void *opaque, QemuOpts *opts, Error **errp) · line 2216
Quoted 5 lines
vl.c +1
-0+g_error_free (error);return -1 ; } }
Regards,
Phil.
[1] https://lists.gnu.org/archive/html/qemu-devel/2018-10/msg01394.html
[2] https://lists.gnu.org/archive/html/qemu-devel/2018-10/msg01406.html
Hello Philippe,
Quoted 9 lines · Philippe Mathieu-Daudé <[email protected]> 于2018年10月9日周二 下午1:52写道:
Hi Li,
Quoted 2 lines · Li Qiang
It makes sense to print the error message while reading file failed.
OK
Quoted 1 line
Quoted 8 lines
Quoted 2 lines
Change since v1:
free errorChanges are useful for reviewer, but not in the git history. You can have them automatically stripped if you place them below the next '---' separator.
Thanks for your advice.
Quoted 30 lines
Hopefully the maintainer taking this patch can clean this up.
Quoted 4 lines
Signed-off-by Li Qiang <[email protected]>Reviewed-by Philippe Mathieu-Daudé <[email protected]>---
Here goes comment not worth to stay forever in git history:
Since v1: ...
vl.c static int parse_fw_cfg(void *opaque, QemuOpts
Quoted 8 lines
vl.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)vl.c +0
-0@@ -2207,8 +2207,10 @@ static int parse_fw_cfg(void *opaque, QemuOpts*opts, Error **errp)
vl.c static int parse_fw_cfg(void *opaque, QemuOpts · line 2207
Quoted 1 line
vl.c +0
-0size =strlen (str);/* NUL terminator NOT included in fw_cfg blob */
vl.c static int parse_fw_cfg(void *opaque, QemuOpts *opts, Error **errp) · line 2212
Quoted 7 lines
vl.c +3
-2buf =g_memdup (str, size); }else { -if (!g_file_get_contents (file, &buf, &size,NULL )) { -error_report ("can't load %s" , file); +GError *error =NULL ; +if (!g_file_get_contents (file, &buf, &size, &error)) { +error_report ("can't load %s, %s" , file, error->message);
Quoted 6 lines
If you ever respin, you can help Markus [1] effort using:
error_setg(errp, "can't load %s, %s", file, error->message);Else your patch will clash with [2].
OK, I will send out this patch based Markus' tree or later when his patch goes to upstream.
Thanks,
Li Qiang
Quoted 14 lines
vl.c static int parse_fw_cfg(void *opaque, QemuOpts *opts, Error **errp) · line 2216
Quoted 6 lines
vl.c +1
-0+g_error_free (error);return -1 ; } }Regards,
Phil.
[1] https://lists.gnu.org/archive/html/qemu-devel/2018-10/msg01394.html
[2] https://lists.gnu.org/archive/html/qemu-devel/2018-10/msg01406.html
Quoted 9 lines · Li Qiang
Hello Philippe,
Quoted 5 lines · Philippe Mathieu-Daudé <[email protected]> 于2018年10月9日周二 下午1:52写道:
Hi Li,
Quoted 2 lines · Li Qiang
It makes sense to print the error message while reading file failed.
[...]
Quoted 16 lines
Quoted 16 lines
vl.c static int parse_fw_cfg(void *opaque, QemuOpts *opts, Error **errp) · line 2212
Quoted 13 lines
vl.c +3
-2@@ -2207,8 +2207,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_report ("can't load %s" , file); +GError *error =NULL ; +if (!g_file_get_contents (file, &buf, &size, &error)) { +error_report ("can't load %s, %s" , file, error->message);If you ever respin, you can help Markus [1] effort using:
Quoted 7 lines
Quoted 4 lines
error_setg(errp, "can't load %s, %s", file, error->message);Else your patch will clash with [2].
OK, I will send out this patch based Markus' tree or later when his patch goes to upstream.
Appreciated!