From patchwork Thu Mar 15 20:06:32 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Denis V. Lunev\" via" X-Patchwork-Id: 10285719 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 31FFB60386 for ; Thu, 15 Mar 2018 20:08:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0AADA28B5C for ; Thu, 15 Mar 2018 20:08:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F2EAA28BF0; Thu, 15 Mar 2018 20:08:00 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 3AB6528B5C for ; Thu, 15 Mar 2018 20:07:59 +0000 (UTC) Received: from localhost ([::1]:53185 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ewZAN-0005X5-1P for patchwork-qemu-devel@patchwork.kernel.org; Thu, 15 Mar 2018 16:07:59 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37866) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ewZ9j-0005EM-22 for qemu-devel@nongnu.org; Thu, 15 Mar 2018 16:07:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ewZ9f-0000C8-QE for qemu-devel@nongnu.org; Thu, 15 Mar 2018 16:07:18 -0400 Received: from smtp52.i.mail.ru ([94.100.177.112]:39354) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ewZ9f-0000An-Er for qemu-devel@nongnu.org; Thu, 15 Mar 2018 16:07:15 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mail.ru; s=mail2; h=Message-Id:Date:Subject:Cc:To:From; bh=lU/j2WyY+P4dXQZ07S2axMzh102PZl3fZPC4OLZ/wEU=; b=KQhUylr5EPIPpP9i/3xve6M//ARrMJck0E4CwNncn8DtQ63PezsCipCY20uqQ5KOIi8WGEFQXxUhXPmH+N1HunD9NYg3nu4/Hjb1vm6xMsPnv0gz6R4p3jVfibH0zu8HxyoLXRJAoM8RWHTDSBMxFDZ/hJZOMjKCcryF8DsYE3Q=; Received: by smtp52.i.mail.ru with esmtpa (envelope-from ) id 1ewZ9b-00086t-NP; Thu, 15 Mar 2018 23:07:12 +0300 To: Jason Wang Date: Thu, 15 Mar 2018 23:06:32 +0300 Message-Id: <1521144392-26203-1-git-send-email-jusual@mail.ru> X-Mailer: git-send-email 2.1.4 Authentication-Results: smtp52.i.mail.ru; auth=pass smtp.auth=jusual@mail.ru smtp.mailfrom=jusual@mail.ru X-7FA49CB5: 0D63561A33F958A58D36DAB6E8A6D906A0599462F7EEE9411A43441FEBAC7E74725E5C173C3A84C3BBEB9517EB7DA65B0FCB30FBB960938BCC4B623DB76FBBCBC4224003CC836476C0CAF46E325F83A50BF2EBBBDD9D6B0FF045C6A0F83C8214574AF45C6390F7469DAA53EE0834AAEE X-Mailru-Sender: E03EFFB74E926B2DFC3B87178F5C03BE758088A96B56B2F7F0D1DED40481EC886F956CAC0F52A8E57C4160E8B47E48163DDE9B364B0DF2898CB68AF7A628805D594FB4C9F0DBF412AE208404248635DF X-Mras: OK X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 94.100.177.112 Subject: [Qemu-devel] [PATCH] net/vde: print error on vde_open() failure X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Julia Suvorova via Qemu-devel From: "Denis V. Lunev\" via" Reply-To: Julia Suvorova Cc: Jim Mussared , Stefan Hajnoczi , qemu-devel@nongnu.org, Markus Armbruster , Joel Stanley , Julia Suvorova Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Despite the fact that now when the initialization of vde fails, qemu does not end silently, no informative error is printed. The patch generates an error and pushes it through the calling function. Related bug: https://bugs.launchpad.net/qemu/+bug/676029 Signed-off-by: Julia Suvorova Reviewed-by: Stefan Hajnoczi --- net/vde.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/net/vde.c b/net/vde.c index e50e5d6..99189cc 100644 --- a/net/vde.c +++ b/net/vde.c @@ -30,6 +30,7 @@ #include "qemu-common.h" #include "qemu/option.h" #include "qemu/main-loop.h" +#include "qapi/error.h" typedef struct VDEState { NetClientState nc; @@ -76,7 +77,7 @@ static NetClientInfo net_vde_info = { static int net_vde_init(NetClientState *peer, const char *model, const char *name, const char *sock, - int port, const char *group, int mode) + int port, const char *group, int mode, Error **errp) { NetClientState *nc; VDEState *s; @@ -92,6 +93,7 @@ static int net_vde_init(NetClientState *peer, const char *model, vde = vde_open(init_sock, (char *)"QEMU", &args); if (!vde){ + error_setg_errno(errp, errno, "Could not open vde"); return -1; } @@ -112,7 +114,6 @@ static int net_vde_init(NetClientState *peer, const char *model, int net_init_vde(const Netdev *netdev, const char *name, NetClientState *peer, Error **errp) { - /* FIXME error_setg(errp, ...) on failure */ const NetdevVdeOptions *vde; assert(netdev->type == NET_CLIENT_DRIVER_VDE); @@ -120,7 +121,7 @@ int net_init_vde(const Netdev *netdev, const char *name, /* missing optional values have been initialized to "all bits zero" */ if (net_vde_init(peer, "vde", name, vde->sock, vde->port, vde->group, - vde->has_mode ? vde->mode : 0700) == -1) { + vde->has_mode ? vde->mode : 0700, errp) == -1) { return -1; }