Patchwork [15/19] console: Chardev open error reporting, console part

login
register
mail settings
Submitter Markus Armbruster
Date Feb. 7, 2012, 2:09 p.m.
Message ID <1328623766-12287-16-git-send-email-armbru@redhat.com>
Download mbox | patch
Permalink /patch/139958/
State New
Headers show

Comments

Markus Armbruster - Feb. 7, 2012, 2:09 p.m.
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 the message you get when
attempting to create too many consoles from

    chardev: opening backend "vc" failed

to

    qemu-system-x86_64: -chardev vc,id=c13: Can't create more than 12 consoles
    chardev: opening backend "vc" failed

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

Signed-off-by: Markus Armbruster <armbru@redhat.com>
---
 console.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

Patch

diff --git a/console.c b/console.c
index 744ef2d..f6b93bd 100644
--- a/console.c
+++ b/console.c
@@ -1529,8 +1529,8 @@  CharDriverState *text_console_init(QemuOpts *opts)
     } else {
         s = new_console(NULL, TEXT_CONSOLE_FIXED_SIZE);
     }
-
     if (!s) {
+        error_report("Can't create more than %d consoles", MAX_CONSOLES);
         g_free(chr);
         return NULL;
     }