diff mbox

vl.c: Use error_report() when reporting shutdown signal

Message ID 1445882881-16364-1-git-send-email-ehabkost@redhat.com
State New
Headers show

Commit Message

Eduardo Habkost Oct. 26, 2015, 6:08 p.m. UTC
This usage of fprintf(stderr) can't be directly converted to
error_report() like the others, because a single error message is split
into multiple fprintf() calls. Make separate error_report() calls for
each case.

Suggested-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
 vl.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Markus Armbruster Oct. 26, 2015, 6:13 p.m. UTC | #1
Eduardo Habkost <ehabkost@redhat.com> writes:

> This usage of fprintf(stderr) can't be directly converted to
> error_report() like the others, because a single error message is split
> into multiple fprintf() calls. Make separate error_report() calls for
> each case.
>
> Suggested-by: Markus Armbruster <armbru@redhat.com>
> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>

Reviewed-by: Markus Armbruster <armbru@redhat.com>
diff mbox

Patch

diff --git a/vl.c b/vl.c
index dffaf09..afe01b04 100644
--- a/vl.c
+++ b/vl.c
@@ -1624,14 +1624,14 @@  static int qemu_shutdown_requested(void)
 static void qemu_kill_report(void)
 {
     if (!qtest_driver() && shutdown_signal != -1) {
-        fprintf(stderr, "qemu: terminating on signal %d", shutdown_signal);
         if (shutdown_pid == 0) {
             /* This happens for eg ^C at the terminal, so it's worth
              * avoiding printing an odd message in that case.
              */
-            fputc('\n', stderr);
+            error_report("terminating on signal %d", shutdown_signal);
         } else {
-            fprintf(stderr, " from pid " FMT_pid "\n", shutdown_pid);
+            error_report("terminating on signal %d from pid " FMT_pid,
+                         shutdown_signal, shutdown_pid);
         }
         shutdown_signal = -1;
     }