* [PATCH] qsd: Do not use error_report() before monitor_init
@ 2022-06-09 12:28 Hanna Reitz
2022-06-10 13:30 ` Philippe Mathieu-Daudé via
2022-06-10 13:45 ` Peter Maydell
0 siblings, 2 replies; 3+ messages in thread
From: Hanna Reitz @ 2022-06-09 12:28 UTC (permalink / raw)
To: qemu-block; +Cc: qemu-devel, Hanna Reitz, Kevin Wolf
error_report() only works once monitor_init_globals_core() has been
called, which is not the case when parsing the --daemonize option. Use
fprintf(stderr, ...) instead.
Fixes: 2525edd85fec53e23fda98974a15e3b3c8957596 ("qsd: Add --daemonize")
Signed-off-by: Hanna Reitz <hreitz@redhat.com>
---
storage-daemon/qemu-storage-daemon.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/storage-daemon/qemu-storage-daemon.c b/storage-daemon/qemu-storage-daemon.c
index c104817cdd..0890495c40 100644
--- a/storage-daemon/qemu-storage-daemon.c
+++ b/storage-daemon/qemu-storage-daemon.c
@@ -286,7 +286,11 @@ static void process_options(int argc, char *argv[], bool pre_init_pass)
}
case OPTION_DAEMONIZE:
if (os_set_daemonize(true) < 0) {
- error_report("--daemonize not supported in this build");
+ /*
+ * --daemonize is parsed before monitor_init_globals_core(), so
+ * error_report() does not work yet
+ */
+ fprintf(stderr, "--daemonize not supported in this build\n");
exit(EXIT_FAILURE);
}
break;
--
2.35.3
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] qsd: Do not use error_report() before monitor_init
2022-06-09 12:28 [PATCH] qsd: Do not use error_report() before monitor_init Hanna Reitz
@ 2022-06-10 13:30 ` Philippe Mathieu-Daudé via
2022-06-10 13:45 ` Peter Maydell
1 sibling, 0 replies; 3+ messages in thread
From: Philippe Mathieu-Daudé via @ 2022-06-10 13:30 UTC (permalink / raw)
To: Hanna Reitz, qemu-block; +Cc: qemu-devel, Kevin Wolf
On 9/6/22 14:28, Hanna Reitz wrote:
> error_report() only works once monitor_init_globals_core() has been
> called, which is not the case when parsing the --daemonize option. Use
> fprintf(stderr, ...) instead.
>
> Fixes: 2525edd85fec53e23fda98974a15e3b3c8957596 ("qsd: Add --daemonize")
> Signed-off-by: Hanna Reitz <hreitz@redhat.com>
> ---
> storage-daemon/qemu-storage-daemon.c | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] qsd: Do not use error_report() before monitor_init
2022-06-09 12:28 [PATCH] qsd: Do not use error_report() before monitor_init Hanna Reitz
2022-06-10 13:30 ` Philippe Mathieu-Daudé via
@ 2022-06-10 13:45 ` Peter Maydell
1 sibling, 0 replies; 3+ messages in thread
From: Peter Maydell @ 2022-06-10 13:45 UTC (permalink / raw)
To: Hanna Reitz; +Cc: qemu-block, qemu-devel, Kevin Wolf, Markus Armbruster
On Thu, 9 Jun 2022 at 15:26, Hanna Reitz <hreitz@redhat.com> wrote:
>
> error_report() only works once monitor_init_globals_core() has been
> called, which is not the case when parsing the --daemonize option. Use
> fprintf(stderr, ...) instead.
>
> Fixes: 2525edd85fec53e23fda98974a15e3b3c8957596 ("qsd: Add --daemonize")
> Signed-off-by: Hanna Reitz <hreitz@redhat.com>
> ---
> storage-daemon/qemu-storage-daemon.c | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/storage-daemon/qemu-storage-daemon.c b/storage-daemon/qemu-storage-daemon.c
> index c104817cdd..0890495c40 100644
> --- a/storage-daemon/qemu-storage-daemon.c
> +++ b/storage-daemon/qemu-storage-daemon.c
> @@ -286,7 +286,11 @@ static void process_options(int argc, char *argv[], bool pre_init_pass)
> }
> case OPTION_DAEMONIZE:
> if (os_set_daemonize(true) < 0) {
> - error_report("--daemonize not supported in this build");
> + /*
> + * --daemonize is parsed before monitor_init_globals_core(), so
> + * error_report() does not work yet
> + */
> + fprintf(stderr, "--daemonize not supported in this build\n");
> exit(EXIT_FAILURE);
> }
> break;
Is it worth making error_report() have code for "called in early startup
before monitor was initialized" that falls back to "just print to stderr"?
Having our standard error reporting function not be usable everywhere is
kind of surprising...
-- PMM
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-06-10 13:47 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-06-09 12:28 [PATCH] qsd: Do not use error_report() before monitor_init Hanna Reitz
2022-06-10 13:30 ` Philippe Mathieu-Daudé via
2022-06-10 13:45 ` Peter Maydell
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).