提交 433672b0 编写于 作者: M Markus Armbruster

error: Clean up errors with embedded newlines (again)

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 474c2134 cleaned up some, but they keep coming
back.  Offenders tracked down with the Coccinelle semantic patch from
commit 312fd5f2.

Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Pavel Fedin <p.fedin@samsung.com>
Signed-off-by: NMarkus Armbruster <armbru@pond.sub.org>
Reviewed-by: NLaszlo Ersek <lersek@redhat.com>
Reviewed-by: NEric Blake <eblake@redhat.com>
Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
上级 bf89e874
...@@ -377,8 +377,8 @@ ISADevice *pc_find_fdc0(void) ...@@ -377,8 +377,8 @@ ISADevice *pc_find_fdc0(void)
if (state.multiple) { if (state.multiple) {
error_report("warning: multiple floppy disk controllers with " error_report("warning: multiple floppy disk controllers with "
"iobase=0x3f0 have been found;\n" "iobase=0x3f0 have been found");
"the one being picked for CMOS setup might not reflect " error_printf("the one being picked for CMOS setup might not reflect "
"your intent"); "your intent");
} }
......
...@@ -2063,9 +2063,9 @@ void kvm_device_access(int fd, int group, uint64_t attr, ...@@ -2063,9 +2063,9 @@ void kvm_device_access(int fd, int group, uint64_t attr,
write ? KVM_SET_DEVICE_ATTR : KVM_GET_DEVICE_ATTR, write ? KVM_SET_DEVICE_ATTR : KVM_GET_DEVICE_ATTR,
&kvmattr); &kvmattr);
if (err < 0) { if (err < 0) {
error_report("KVM_%s_DEVICE_ATTR failed: %s\n" error_report("KVM_%s_DEVICE_ATTR failed: %s",
"Group %d attr 0x%016" PRIx64, write ? "SET" : "GET", write ? "SET" : "GET", strerror(-err));
strerror(-err), group, attr); error_printf("Group %d attr 0x%016" PRIx64, group, attr);
abort(); abort();
} }
} }
......
...@@ -599,9 +599,8 @@ int main(int argc, char **argv) ...@@ -599,9 +599,8 @@ int main(int argc, char **argv)
} }
if ((argc - optind) != 1) { if ((argc - optind) != 1) {
error_report("Invalid number of argument.\n" error_report("Invalid number of arguments");
"Try `%s --help' for more information.", error_printf("Try `%s --help' for more information.\n", argv[0]);
argv[0]);
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册