From 2a96fb4f0836f4183cb2b81e121bbd0100f3c3ff Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Mon, 9 Jan 2012 13:37:35 +0100 Subject: [PATCH 8/9] Strip trailing '\n' from error_report()'s first argument RH-Author: Markus Armbruster Message-id: <1326116256-3685-9-git-send-email-armbru@redhat.com> Patchwork-id: 36285 O-Subject: [RHEL-6.3 PATCH qemu-kvm 8/9] Strip trailing '\n' from error_report()'s first argument Bugzilla: 737879 RH-Acked-by: Paolo Bonzini RH-Acked-by: Kevin Wolf RH-Acked-by: Amit Shah error_report() prepends location, and appends a newline. The message constructed from the arguments should not contain a newline. Fix the obvious offenders. Signed-off-by: Markus Armbruster Signed-off-by: Stefan Hajnoczi (cherry picked from commit 6daf194dde15acda153b824299f36f12dfa527a6) Conflicts: block-migration.c block/qcow2.c block/sheepdog.c hw/milkymist-minimac2.c hw/milkymist-pfpu.c hw/milkymist-softusb.c hw/milkymist-tmu2.c hw/strongarm.c hw/virtio-serial-bus.c hw/virtio.c net/socket.c qemu-img.c --- hw/qdev.c | 2 +- hw/usb-ccid.c | 2 +- hw/virtio-serial-bus.c | 10 +++++----- net.c | 2 +- qemu-error.c | 2 ++ 5 files changed, 10 insertions(+), 8 deletions(-) Signed-off-by: Michal Novotny --- hw/qdev.c | 2 +- hw/usb-ccid.c | 2 +- hw/virtio-serial-bus.c | 10 +++++----- net.c | 2 +- qemu-error.c | 2 ++ 5 files changed, 10 insertions(+), 8 deletions(-) diff --git a/hw/qdev.c b/hw/qdev.c index 4c2cedf..9a8b7b4 100644 --- a/hw/qdev.c +++ b/hw/qdev.c @@ -330,7 +330,7 @@ void qdev_init_nofail(DeviceState *dev) DeviceInfo *info = dev->info; if (qdev_init(dev) < 0) { - error_report("Initialization of device %s failed\n", info->name); + error_report("Initialization of device %s failed", info->name); exit(1); } } diff --git a/hw/usb-ccid.c b/hw/usb-ccid.c index 16f703e..88a9621 100644 --- a/hw/usb-ccid.c +++ b/hw/usb-ccid.c @@ -1253,7 +1253,7 @@ static int ccid_card_init(DeviceState *qdev, DeviceInfo *base) return -1; } if (s->card != NULL) { - error_report("Warning: usb-ccid card already full, not adding\n"); + error_report("Warning: usb-ccid card already full, not adding"); return -1; } ret = info->initfn ? info->initfn(card) : ret; diff --git a/hw/virtio-serial-bus.c b/hw/virtio-serial-bus.c index 6b3c100..463863f 100644 --- a/hw/virtio-serial-bus.c +++ b/hw/virtio-serial-bus.c @@ -375,7 +375,7 @@ static void handle_control_message(VirtIOSerial *vser, void *buf, size_t len) switch(cpkt.event) { case VIRTIO_CONSOLE_DEVICE_READY: if (!cpkt.value) { - error_report("virtio-serial-bus: Guest failure in adding device %s\n", + error_report("virtio-serial-bus: Guest failure in adding device %s", vser->bus.qbus.name); break; } @@ -390,7 +390,7 @@ static void handle_control_message(VirtIOSerial *vser, void *buf, size_t len) case VIRTIO_CONSOLE_PORT_READY: if (!cpkt.value) { - error_report("virtio-serial-bus: Guest failure in adding port %u for device %s\n", + error_report("virtio-serial-bus: Guest failure in adding port %u for device %s", port->id, vser->bus.qbus.name); break; } @@ -798,7 +798,7 @@ static int virtser_port_qdev_init(DeviceState *qdev, DeviceInfo *base) plugging_port0 = port->is_console && !find_port_by_id(port->vser, 0); if (find_port_by_id(port->vser, port->id)) { - error_report("virtio-serial-bus: A port already exists at id %u\n", + error_report("virtio-serial-bus: A port already exists at id %u", port->id); return -1; } @@ -809,14 +809,14 @@ static int virtser_port_qdev_init(DeviceState *qdev, DeviceInfo *base) } else { port->id = find_free_port_id(port->vser); if (port->id == VIRTIO_CONSOLE_BAD_ID) { - error_report("virtio-serial-bus: Maximum port limit for this device reached\n"); + error_report("virtio-serial-bus: Maximum port limit for this device reached"); return -1; } } } if (port->id >= port->vser->config.max_nr_ports) { - error_report("virtio-serial-bus: Out-of-range port id specified, max. allowed: %u\n", + error_report("virtio-serial-bus: Out-of-range port id specified, max. allowed: %u", port->vser->config.max_nr_ports - 1); return -1; } diff --git a/net.c b/net.c index c5b2541..4a13bfd 100644 --- a/net.c +++ b/net.c @@ -775,7 +775,7 @@ int qemu_find_nic_model(NICInfo *nd, const char * const *models, return i; } - error_report("qemu: Unsupported NIC model: %s", nd->model); + error_report("Unsupported NIC model: %s", nd->model); return -1; } diff --git a/qemu-error.c b/qemu-error.c index 57d7555..81143ab 100644 --- a/qemu-error.c +++ b/qemu-error.c @@ -194,6 +194,8 @@ void error_print_loc(void) /* * Print an error message to current monitor if we have one, else to stderr. + * Format arguments like sprintf(). The result should not contain + * newlines. * Prepend the current location and append a newline. * It's wrong to call this in a QMP monitor. Use qerror_report() there. */ -- 1.7.7.4