From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LNPF8-0001YT-QH for qemu-devel@nongnu.org; Thu, 15 Jan 2009 05:14:31 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LNPF5-0001Wt-GX for qemu-devel@nongnu.org; Thu, 15 Jan 2009 05:14:28 -0500 Received: from [199.232.76.173] (port=36198 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LNPF4-0001Wj-QU for qemu-devel@nongnu.org; Thu, 15 Jan 2009 05:14:27 -0500 Received: from mx2.redhat.com ([66.187.237.31]:60959) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1LNPF4-0007q4-E2 for qemu-devel@nongnu.org; Thu, 15 Jan 2009 05:14:26 -0500 Received: from int-mx2.corp.redhat.com (int-mx2.corp.redhat.com [172.16.27.26]) by mx2.redhat.com (8.13.8/8.13.8) with ESMTP id n0FAEPF8001026 for ; Thu, 15 Jan 2009 05:14:25 -0500 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx2.corp.redhat.com (8.13.1/8.13.1) with ESMTP id n0FAEQwW017081 for ; Thu, 15 Jan 2009 05:14:26 -0500 Received: from dhcp-1-237.tlv.redhat.com (dhcp-1-237.tlv.redhat.com [10.35.1.237]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id n0FAEPAh025120 for ; Thu, 15 Jan 2009 05:14:25 -0500 Received: from dhcp-1-237.tlv.redhat.com (localhost [127.0.0.1]) by dhcp-1-237.tlv.redhat.com (Postfix) with ESMTP id E197318D407 for ; Thu, 15 Jan 2009 12:12:52 +0200 (IST) From: Gleb Natapov Date: Thu, 15 Jan 2009 12:12:52 +0200 Message-ID: <20090115101252.13211.23542.stgit@dhcp-1-237.tlv.redhat.com> In-Reply-To: <20090115101241.13211.64596.stgit@dhcp-1-237.tlv.redhat.com> References: <20090115101241.13211.64596.stgit@dhcp-1-237.tlv.redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Subject: [Qemu-devel] [PATCH v2 3/3] Return -errno on write failure Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Signed-off-by: Gleb Natapov --- block-raw-posix.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/block-raw-posix.c b/block-raw-posix.c index 2fbb714..d17af0b 100644 --- a/block-raw-posix.c +++ b/block-raw-posix.c @@ -252,7 +252,7 @@ static int raw_pwrite_aligned(BlockDriverState *bs, int64_t offset, ret = fd_open(bs); if (ret < 0) - return ret; + return -errno; if (offset >= 0 && lseek(s->fd, offset, SEEK_SET) == (off_t)-1) { ++(s->lseek_err_cnt); @@ -262,7 +262,7 @@ static int raw_pwrite_aligned(BlockDriverState *bs, int64_t offset, s->fd, bs->filename, offset, buf, count, bs->total_sectors, errno, strerror(errno)); } - return -1; + return -EIO; } s->lseek_err_cnt = 0; @@ -277,7 +277,7 @@ static int raw_pwrite_aligned(BlockDriverState *bs, int64_t offset, label__raw_write__success: - return ret; + return (ret < 0) ? -errno : ret; }