[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 15/34] net: inet_connect(), inet_connect_opts(): ret
From: |
Luiz Capitulino |
Subject: |
[Qemu-devel] [PATCH 15/34] net: inet_connect(), inet_connect_opts(): return -errno |
Date: |
Wed, 1 Aug 2012 22:02:35 -0300 |
Next commit wants to use this.
Signed-off-by: Luiz Capitulino <address@hidden>
---
This patch is an interesting case, because one of the goal of the error
format that's being replaced was that callers could use it to know the
error cause (with error_is_type().
However, the new error format doesn't allow this as most errors are
class GenericError. So, we'll have to use errno to know the error cause,
this is the case of inet_connect() when called by
tcp_start_outgoing_migration().
qemu-sockets.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/qemu-sockets.c b/qemu-sockets.c
index 33b65cf..82f4736 100644
--- a/qemu-sockets.c
+++ b/qemu-sockets.c
@@ -234,7 +234,7 @@ int inet_connect_opts(QemuOpts *opts, bool *in_progress,
Error **errp)
if (addr == NULL || port == NULL) {
fprintf(stderr, "inet_connect: host and/or port not specified\n");
error_set(errp, QERR_SOCKET_CREATE_FAILED);
- return -1;
+ return -EINVAL;
}
if (qemu_opt_get_bool(opts, "ipv4", 0))
@@ -247,7 +247,7 @@ int inet_connect_opts(QemuOpts *opts, bool *in_progress,
Error **errp)
fprintf(stderr,"getaddrinfo(%s,%s): %s\n", addr, port,
gai_strerror(rc));
error_set(errp, QERR_SOCKET_CREATE_FAILED);
- return -1;
+ return -EINVAL;
}
for (e = res; e != NULL; e = e->ai_next) {
@@ -300,7 +300,7 @@ int inet_connect_opts(QemuOpts *opts, bool *in_progress,
Error **errp)
}
error_set(errp, QERR_SOCKET_CONNECT_FAILED);
freeaddrinfo(res);
- return -1;
+ return -ENOTCONN;
}
int inet_dgram_opts(QemuOpts *opts)
@@ -508,6 +508,7 @@ int inet_connect(const char *str, bool block, bool
*in_progress, Error **errp)
}
sock = inet_connect_opts(opts, in_progress, errp);
} else {
+ sock = -EINVAL;
error_set(errp, QERR_SOCKET_CREATE_FAILED);
}
qemu_opts_del(opts);
--
1.7.11.2.249.g31c7954.dirty
- Re: [Qemu-devel] [PATCH 11/34] qmp: query-block: add 'valid_encryption_key' field, (continued)
[Qemu-devel] [PATCH 13/34] hmp: hmp_change(): don't rely on QERR_DEVICE_ENCRYPTED, Luiz Capitulino, 2012/08/01
Re: [Qemu-devel] [PATCH 13/34] hmp: hmp_change(): don't rely on QERR_DEVICE_ENCRYPTED, Luiz Capitulino, 2012/08/02
Re: [Qemu-devel] [PATCH 13/34] hmp: hmp_change(): don't rely on QERR_DEVICE_ENCRYPTED, Luiz Capitulino, 2012/08/02
[Qemu-devel] [PATCH 15/34] net: inet_connect(), inet_connect_opts(): return -errno,
Luiz Capitulino <=
- Re: [Qemu-devel] [PATCH 15/34] net: inet_connect(), inet_connect_opts(): return -errno, Luiz Capitulino, 2012/08/02
- Re: [Qemu-devel] [PATCH 15/34] net: inet_connect(), inet_connect_opts(): return -errno, Markus Armbruster, 2012/08/02
- Re: [Qemu-devel] [PATCH 15/34] net: inet_connect(), inet_connect_opts(): return -errno, Luiz Capitulino, 2012/08/02
- Re: [Qemu-devel] [PATCH 15/34] net: inet_connect(), inet_connect_opts(): return -errno, Amos Kong, 2012/08/06
- Re: [Qemu-devel] [PATCH 15/34] net: inet_connect(), inet_connect_opts(): return -errno, Luiz Capitulino, 2012/08/06
[Qemu-devel] [PATCH 17/34] qerror: drop QERR_SOCKET_CONNECT_IN_PROGRESS, Luiz Capitulino, 2012/08/01