[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 10/18] qemu-char: ask and print error informatio
From: |
Luiz Capitulino |
Subject: |
Re: [Qemu-devel] [PATCH 10/18] qemu-char: ask and print error information from qemu-sockets |
Date: |
Thu, 4 Oct 2012 16:16:08 -0300 |
On Wed, 3 Oct 2012 16:36:57 +0200
Paolo Bonzini <address@hidden> wrote:
> Before:
>
> $ qemu-system-x86_64 -monitor tcp:localhost:6000
> (starts despite error)
>
> $ qemu-system-x86_64 -monitor tcp:foo.bar:12345
> getaddrinfo(foo.bar,12345): Name or service not known
> chardev: opening backend "socket" failed
>
> $ qemu-system-x86_64 -monitor tcp:localhost:443,server=on
> inet_listen_opts: bind(ipv4,127.0.0.1,443): Permission denied
> inet_listen_opts: FAILED
> chardev: opening backend "socket" failed
>
> After:
>
> $ x86_64-softmmu/qemu-system-x86_64 -monitor tcp:localhost:6000
> x86_64-softmmu/qemu-system-x86_64: -monitor tcp:localhost:6000: Failed to
> connect to socket: Connection refused
> chardev: opening backend "socket" failed
>
> $ x86_64-softmmu/qemu-system-x86_64 -monitor tcp:foo.bar:12345
> qemu-system-x86_64: -monitor tcp:foo.bar:12345: address resolution failed
> for foo.bar:12345: Name or service not known
> chardev: opening backend "socket" failed
>
> $ x86_64-softmmu/qemu-system-x86_64 -monitor tcp:localhost:443,server=on
> qemu-system-x86_64: -monitor tcp:localhost:443,server=on: Failed to bind
> socket: Permission denied
> chardev: opening backend "socket" failed
>
> Signed-off-by: Paolo Bonzini <address@hidden>
Reviewed-by: Luiz Capitulino <address@hidden>
> ---
> qemu-char.c | 23 +++++++++++++++++------
> 1 file modificato, 17 inserzioni(+), 6 rimozioni(-)
>
> diff --git a/qemu-char.c b/qemu-char.c
> index 8ebd582..04b5c23 100644
> --- a/qemu-char.c
> +++ b/qemu-char.c
> @@ -2097,12 +2097,13 @@ static CharDriverState *qemu_chr_open_udp(QemuOpts
> *opts)
> {
> CharDriverState *chr = NULL;
> NetCharDriver *s = NULL;
> + Error *local_err = NULL;
> int fd = -1;
>
> chr = g_malloc0(sizeof(CharDriverState));
> s = g_malloc0(sizeof(NetCharDriver));
>
> - fd = inet_dgram_opts(opts, NULL);
> + fd = inet_dgram_opts(opts, &local_err);
> if (fd < 0) {
> fprintf(stderr, "inet_dgram_opts failed\n");
> goto return_err;
> @@ -2118,6 +2119,10 @@ static CharDriverState *qemu_chr_open_udp(QemuOpts
> *opts)
> return chr;
>
> return_err:
> + if (local_err) {
> + qerror_report_err(local_err);
> + error_free(local_err);
> + }
> g_free(chr);
> g_free(s);
> if (fd >= 0) {
> @@ -2428,6 +2433,7 @@ static CharDriverState *qemu_chr_open_socket(QemuOpts
> *opts)
> {
> CharDriverState *chr = NULL;
> TCPCharDriver *s = NULL;
> + Error *local_err = NULL;
> int fd = -1;
> int is_listen;
> int is_waitconnect;
> @@ -2448,15 +2454,15 @@ static CharDriverState *qemu_chr_open_socket(QemuOpts
> *opts)
>
> if (is_unix) {
> if (is_listen) {
> - fd = unix_listen_opts(opts, NULL);
> + fd = unix_listen_opts(opts, &local_err);
> } else {
> - fd = unix_connect_opts(opts, NULL, NULL, NULL);
> + fd = unix_connect_opts(opts, &local_err, NULL, NULL);
> }
> } else {
> if (is_listen) {
> - fd = inet_listen_opts(opts, 0, NULL);
> + fd = inet_listen_opts(opts, 0, &local_err);
> } else {
> - fd = inet_connect_opts(opts, NULL, NULL, NULL);
> + fd = inet_connect_opts(opts, &local_err, NULL, NULL);
> }
> }
> if (fd < 0) {
> @@ -2517,8 +2523,13 @@ static CharDriverState *qemu_chr_open_socket(QemuOpts
> *opts)
> return chr;
>
> fail:
> - if (fd >= 0)
> + if (local_err) {
> + qerror_report_err(local_err);
> + error_free(local_err);
> + }
> + if (fd >= 0) {
> closesocket(fd);
> + }
> g_free(s);
> g_free(chr);
> return NULL;
- Re: [Qemu-devel] [PATCH 08/18] migration (outgoing): add error propagation for fd and exec protocols, (continued)
[Qemu-devel] [PATCH 11/18] nbd: ask and print error information from qemu-sockets, Paolo Bonzini, 2012/10/03
[Qemu-devel] [PATCH 12/18] qemu-ga: ask and print error information from qemu-sockets, Paolo Bonzini, 2012/10/03
[Qemu-devel] [PATCH 10/18] qemu-char: ask and print error information from qemu-sockets, Paolo Bonzini, 2012/10/03
- Re: [Qemu-devel] [PATCH 10/18] qemu-char: ask and print error information from qemu-sockets,
Luiz Capitulino <=
[Qemu-devel] [PATCH 17/18] qemu-sockets: add error propagation to inet_parse, Paolo Bonzini, 2012/10/03
[Qemu-devel] [PATCH 15/18] qemu-sockets: add error propagation to inet_connect_addr, Paolo Bonzini, 2012/10/03
[Qemu-devel] [PATCH 16/18] qemu-sockets: add error propagation to inet_dgram_opts, Paolo Bonzini, 2012/10/03
[Qemu-devel] [PATCH 13/18] vnc: add error propagation to vnc_display_open, Paolo Bonzini, 2012/10/03