From a30ecde6e795682d1473c45acae66a60a76fca2f Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Fri, 15 May 2015 13:58:50 +0200 Subject: net: Permit incremental conversion of init functions to Error Error reporting for netdev_add is broken: the net_client_init_fun[] report the actual errors with (at best) error_report(), and their caller net_client_init1() makes up a generic error on top. For command line and HMP, this produces an mildly ugly error cascade. In QMP, the actual errors go to stderr, and the generic error becomes the command's error reply. To fix this, we need to convert the net_client_init_fun[] to Error. To permit fixing them one by one, add an Error ** parameter to the net_client_init_fun[]. If the call fails without returning an Error, make up the same generic Error as before. But if it returns one, use that instead. Since none of them does so far, no functional change. Signed-off-by: Markus Armbruster Reviewed-by: Eric Blake Message-id: 1431691143-1015-3-git-send-email-armbru@redhat.com Signed-off-by: Stefan Hajnoczi --- net/socket.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'net/socket.c') diff --git a/net/socket.c b/net/socket.c index c30e03f5ae..5a19aa1881 100644 --- a/net/socket.c +++ b/net/socket.c @@ -693,8 +693,9 @@ static int net_socket_udp_init(NetClientState *peer, } int net_init_socket(const NetClientOptions *opts, const char *name, - NetClientState *peer) + NetClientState *peer, Error **errp) { + /* FIXME error_setg(errp, ...) on failure */ Error *err = NULL; const NetdevSocketOptions *sock; -- cgit v1.2.1