From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55815) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YYC6q-0007CB-RJ for qemu-devel@nongnu.org; Wed, 18 Mar 2015 07:26:01 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YYC6p-0001iq-WB for qemu-devel@nongnu.org; Wed, 18 Mar 2015 07:26:00 -0400 Received: from mail-we0-x229.google.com ([2a00:1450:400c:c03::229]:33229) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YYC6p-0001ik-If for qemu-devel@nongnu.org; Wed, 18 Mar 2015 07:25:59 -0400 Received: by weop45 with SMTP id p45so29682660weo.0 for ; Wed, 18 Mar 2015 04:25:59 -0700 (PDT) Sender: Paolo Bonzini From: Paolo Bonzini Date: Wed, 18 Mar 2015 12:24:52 +0100 Message-Id: <1426677906-51657-6-git-send-email-pbonzini@redhat.com> In-Reply-To: <1426677906-51657-1-git-send-email-pbonzini@redhat.com> References: <1426677906-51657-1-git-send-email-pbonzini@redhat.com> Subject: [Qemu-devel] [PULL 05/19] nbd: Pass return value from nbd_handle_list() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Max Reitz From: Max Reitz While it does not make a difference in practice, nbd_receive_options() generally returns -errno, so it should do that here as well; and the easiest way to achieve this is by passing on the value returned by nbd_handle_list(). Signed-off-by: Max Reitz Message-Id: <1424887718-10800-7-git-send-email-mreitz@redhat.com> Signed-off-by: Paolo Bonzini --- nbd.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/nbd.c b/nbd.c index 02ba0fe..34f4dbb 100644 --- a/nbd.c +++ b/nbd.c @@ -351,7 +351,7 @@ fail: static int nbd_receive_options(NBDClient *client) { while (1) { - int csock = client->sock; + int csock = client->sock, ret; uint32_t tmp, length; uint64_t magic; @@ -398,8 +398,9 @@ static int nbd_receive_options(NBDClient *client) TRACE("Checking option"); switch (be32_to_cpu(tmp)) { case NBD_OPT_LIST: - if (nbd_handle_list(client, length) < 0) { - return 1; + ret = nbd_handle_list(client, length); + if (ret < 0) { + return ret; } break; -- 2.3.0