From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38873) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a9x4E-0005Js-W6 for qemu-devel@nongnu.org; Fri, 18 Dec 2015 10:35:40 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1a9x4D-00034e-0d for qemu-devel@nongnu.org; Fri, 18 Dec 2015 10:35:38 -0500 Received: from mx1.redhat.com ([209.132.183.28]:35114) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a9x4C-00034J-98 for qemu-devel@nongnu.org; Fri, 18 Dec 2015 10:35:36 -0500 From: Markus Armbruster Date: Fri, 18 Dec 2015 16:35:24 +0100 Message-Id: <1450452927-8346-22-git-send-email-armbru@redhat.com> In-Reply-To: <1450452927-8346-1-git-send-email-armbru@redhat.com> References: <1450452927-8346-1-git-send-email-armbru@redhat.com> Subject: [Qemu-devel] [PATCH v3 21/24] error: Clean up errors with embedded newlines (again) List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Laszlo Ersek , Pavel Fedin , Markus Armbruster The arguments of error_report() should yield a short error string without newlines. A few places try to print additional help after the error message by embedding newlines in the error string. That's nice, but let's do it the right way. Commit 474c213 cleaned up some, but they keep coming back. Offenders tracked down with the Coccinelle semantic patch from commit 312fd5f. Cc: Laszlo Ersek Cc: Pavel Fedin Signed-off-by: Markus Armbruster Reviewed-by: Laszlo Ersek Reviewed-by: Eric Blake Signed-off-by: Markus Armbruster --- hw/i386/pc.c | 4 ++-- kvm-all.c | 6 +++--- qemu-nbd.c | 5 ++--- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/hw/i386/pc.c b/hw/i386/pc.c index ba7b414..f41c448 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -419,8 +419,8 @@ static void pc_cmos_init_late(void *opaque) if (state.multiple) { error_report("warning: multiple floppy disk controllers with " - "iobase=0x3f0 have been found;\n" - "the one being picked for CMOS setup might not reflect " + "iobase=0x3f0 have been found"); + error_printf("the one being picked for CMOS setup might not reflect " "your intent"); } pc_cmos_init_floppy(s, state.floppy); diff --git a/kvm-all.c b/kvm-all.c index bd9e764..9148889 100644 --- a/kvm-all.c +++ b/kvm-all.c @@ -2063,9 +2063,9 @@ void kvm_device_access(int fd, int group, uint64_t attr, write ? KVM_SET_DEVICE_ATTR : KVM_GET_DEVICE_ATTR, &kvmattr); if (err < 0) { - error_report("KVM_%s_DEVICE_ATTR failed: %s\n" - "Group %d attr 0x%016" PRIx64, write ? "SET" : "GET", - strerror(-err), group, attr); + error_report("KVM_%s_DEVICE_ATTR failed: %s", + write ? "SET" : "GET", strerror(-err)); + error_printf("Group %d attr 0x%016" PRIx64, group, attr); abort(); } } diff --git a/qemu-nbd.c b/qemu-nbd.c index 023eacd..a4cf847 100644 --- a/qemu-nbd.c +++ b/qemu-nbd.c @@ -599,9 +599,8 @@ int main(int argc, char **argv) } if ((argc - optind) != 1) { - error_report("Invalid number of argument.\n" - "Try `%s --help' for more information.", - argv[0]); + error_report("Invalid number of arguments"); + error_printf("Try `%s --help' for more information.\n", argv[0]); exit(EXIT_FAILURE); } -- 2.4.3