qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH 12/19] qemu-char: Chardev open error reporting, tty


From: Markus Armbruster
Subject: [Qemu-devel] [PATCH 12/19] qemu-char: Chardev open error reporting, tty part
Date: Tue, 7 Feb 2012 15:09:19 +0100

Unlike many other backends, this one leaves open error reporting to
its caller.  Because the caller doesn't know what went wrong, this
results in a pretty useless error message.

Change it to report its errors.  Improves user-hostile messages like
this one for "-chardev tty,id=foo,path=/dev/ttyy1"

    chardev: opening backend "file" failed

to

    qemu-system-x86_64: -chardev tty,id=foo,path=/dev/ttyy1: Can't open 
'/dev/ttyy1': No such file or directory
    chardev: opening backend "file" failed

The useless "opening backend failed" message will be cleaned up
shortly.

Signed-off-by: Markus Armbruster <address@hidden>
---
 qemu-char.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/qemu-char.c b/qemu-char.c
index 130ed8b..1ff7f4b 100644
--- a/qemu-char.c
+++ b/qemu-char.c
@@ -1231,8 +1231,14 @@ static CharDriverState *qemu_chr_open_tty(QemuOpts *opts)
     CharDriverState *chr;
     int fd;
 
+    if (!filename) {
+        error_report("tty character device requires parameter path");
+        return NULL;
+    }
+
     TFR(fd = qemu_open(filename, O_RDWR | O_NONBLOCK));
     if (fd < 0) {
+        error_report("Can't open '%s': %s", filename, strerror(errno));
         return NULL;
     }
     tty_serial_init(fd, 115200, 'N', 8, 1);
-- 
1.7.6.5




reply via email to

[Prev in Thread] Current Thread [Next in Thread]