From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:36976) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SF0bP-0004mh-LW for qemu-devel@nongnu.org; Tue, 03 Apr 2012 06:04:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SF0bJ-0008JF-CA for qemu-devel@nongnu.org; Tue, 03 Apr 2012 06:04:39 -0400 Received: from mail-yw0-f45.google.com ([209.85.213.45]:36361) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SF0bJ-0008J3-5L for qemu-devel@nongnu.org; Tue, 03 Apr 2012 06:04:33 -0400 Received: by yhoo21 with SMTP id o21so2284419yho.4 for ; Tue, 03 Apr 2012 03:04:31 -0700 (PDT) From: Liu Yuan Date: Tue, 3 Apr 2012 18:04:21 +0800 Message-Id: <1333447461-317-1-git-send-email-namei.unix@gmail.com> In-Reply-To: <4F7ABF13.4060305@redhat.com> References: <4F7ABF13.4060305@redhat.com> Subject: [Qemu-devel] RE. [PATCH] sheepdog: fix send req helpers List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Kevin Wolf , MORITA Kazutaka From: Liu Yuan Yes, I think so. Here is the patch. Subject: [PATCH] sheepdog: fix send req helpers From: Liu Yuan We should return if reading of the header fails. Cc: Kevin Wolf Cc: MORITA Kazutaka Signed-off-by: Liu Yuan --- block/sheepdog.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/block/sheepdog.c b/block/sheepdog.c index 62dfa48..73308b2 100644 --- a/block/sheepdog.c +++ b/block/sheepdog.c @@ -510,6 +510,7 @@ static int send_req(int sockfd, SheepdogReq *hdr, void *data, ret = qemu_send_full(sockfd, hdr, sizeof(*hdr), 0); if (ret < sizeof(*hdr)) { error_report("failed to send a req, %s", strerror(errno)); + return ret; } ret = qemu_send_full(sockfd, data, *wlen, 0); @@ -528,6 +529,7 @@ static int send_co_req(int sockfd, SheepdogReq *hdr, void *data, ret = qemu_co_send(sockfd, hdr, sizeof(*hdr)); if (ret < sizeof(*hdr)) { error_report("failed to send a req, %s", strerror(errno)); + return ret; } ret = qemu_co_send(sockfd, data, *wlen); -- 1.7.8.2