[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 37/41] error: Clean up errors with embedded newlines
From: |
Markus Armbruster |
Subject: |
[Qemu-devel] [PULL 37/41] error: Clean up errors with embedded newlines (again) |
Date: |
Wed, 13 Jan 2016 16:43:35 +0100 |
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 <address@hidden>
Cc: Pavel Fedin <address@hidden>
Signed-off-by: Markus Armbruster <address@hidden>
Reviewed-by: Laszlo Ersek <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
Signed-off-by: Markus Armbruster <address@hidden>
---
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 0e5c86a..9e37186 100644
--- a/hw/i386/pc.c
+++ b/hw/i386/pc.c
@@ -377,8 +377,8 @@ ISADevice *pc_find_fdc0(void)
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");
}
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
- [Qemu-devel] [PULL 41/41] checkpatch: Detect newlines in error_report and other error functions, (continued)
- [Qemu-devel] [PULL 41/41] checkpatch: Detect newlines in error_report and other error functions, Markus Armbruster, 2016/01/13
- [Qemu-devel] [PULL 33/41] vmdk: Clean up control flow in vmdk_parse_extents() a bit, Markus Armbruster, 2016/01/13
- [Qemu-devel] [PULL 26/41] error: Don't decorate original error message when adding to it, Markus Armbruster, 2016/01/13
- [Qemu-devel] [PULL 32/41] error: Strip trailing '\n' from error string arguments (again), Markus Armbruster, 2016/01/13
- [Qemu-devel] [PULL 40/41] error: Consistently name Error * objects err, and not errp, Markus Armbruster, 2016/01/13
- [Qemu-devel] [PULL 22/41] block: Clean up "Could not create temporary overlay" error message, Markus Armbruster, 2016/01/13
- [Qemu-devel] [PULL 27/41] error: Use error_reportf_err() where it makes obvious sense, Markus Armbruster, 2016/01/13
- [Qemu-devel] [PULL 30/41] migration: Use error_reportf_err() instead of monitor_printf(), Markus Armbruster, 2016/01/13
- [Qemu-devel] [PULL 34/41] vmdk: Clean up "Invalid extent lines" error message, Markus Armbruster, 2016/01/13
- [Qemu-devel] [PULL 39/41] s390/sclp: Simplify control flow in sclp_realize(), Markus Armbruster, 2016/01/13
- [Qemu-devel] [PULL 37/41] error: Clean up errors with embedded newlines (again),
Markus Armbruster <=
- [Qemu-devel] [PULL 38/41] hw/s390x: Rename local variables Error *l_err to just err, Markus Armbruster, 2016/01/13
- [Qemu-devel] [PULL 04/41] hw: Don't use hw_error() for machine initialization errors, Markus Armbruster, 2016/01/13
- [Qemu-devel] [PULL 31/41] qemu-io qemu-nbd: Use error_report() etc. instead of fprintf(), Markus Armbruster, 2016/01/13
- Re: [Qemu-devel] [PULL 00/41] Error reporting patches for 2016-01-13, Peter Maydell, 2016/01/14