aboutsummaryrefslogtreecommitdiff
path: root/console.c
diff options
context:
space:
mode:
authorKevin Wolf <kwolf@redhat.com>2011-06-01 13:29:11 +0200
committerAnthony Liguori <aliguori@us.ibm.com>2011-07-23 11:18:57 -0500
commit6e1db57b2ac9025c2443c665a0d9e78748637b26 (patch)
treecb4b73d71dccfc14737c713b07ee3bf89a3c0cf2 /console.c
parent84682834eb8f654da5e03a92930d80b8ae0d3065 (diff)
downloadqemu-6e1db57b2ac9025c2443c665a0d9e78748637b26.zip
qemu-6e1db57b2ac9025c2443c665a0d9e78748637b26.tar.gz
qemu-6e1db57b2ac9025c2443c665a0d9e78748637b26.tar.bz2
qemu-char: Print strerror message on failure
The only way for chardev drivers to communicate an error was to return a NULL pointer, which resulted in an error message that said _that_ something went wrong, but not _why_. This patch changes the interface to return 0/-errno and updates qemu_chr_open_opts to use strerror to display a more helpful error message. Signed-off-by: Kevin Wolf <kwolf@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'console.c')
-rw-r--r--console.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/console.c b/console.c
index acd8ca1..242086cf 100644
--- a/console.c
+++ b/console.c
@@ -1514,7 +1514,7 @@ static void text_console_do_init(CharDriverState *chr, DisplayState *ds)
chr->init(chr);
}
-CharDriverState *text_console_init(QemuOpts *opts)
+int text_console_init(QemuOpts *opts, CharDriverState **_chr)
{
CharDriverState *chr;
TextConsole *s;
@@ -1546,7 +1546,7 @@ CharDriverState *text_console_init(QemuOpts *opts)
if (!s) {
free(chr);
- return NULL;
+ return -EBUSY;
}
s->chr = chr;
@@ -1554,7 +1554,9 @@ CharDriverState *text_console_init(QemuOpts *opts)
s->g_height = height;
chr->opaque = s;
chr->chr_set_echo = text_console_set_echo;
- return chr;
+
+ *_chr = chr;
+ return 0;
}
void text_consoles_set_display(DisplayState *ds)