From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1O9GNm-00051k-IC for qemu-devel@nongnu.org; Tue, 04 May 2010 07:33:46 -0400 Received: from [140.186.70.92] (port=40245 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1O9GNl-00050i-8V for qemu-devel@nongnu.org; Tue, 04 May 2010 07:33:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1O9GNh-0000KD-Cu for qemu-devel@nongnu.org; Tue, 04 May 2010 07:33:45 -0400 Received: from mx1.redhat.com ([209.132.183.28]:58431) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1O9GNh-0000Ju-5O for qemu-devel@nongnu.org; Tue, 04 May 2010 07:33:41 -0400 Date: Tue, 4 May 2010 17:01:51 +0530 From: Amit Shah Message-ID: <20100504113151.GD8136@amit-x200.redhat.com> References: <1272970367-24647-1-git-send-email-amit.shah@redhat.com> <1272970367-24647-2-git-send-email-amit.shah@redhat.com> <1272970367-24647-3-git-send-email-amit.shah@redhat.com> <1272970367-24647-4-git-send-email-amit.shah@redhat.com> <4BE0040A.3020906@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4BE0040A.3020906@redhat.com> Subject: [Qemu-devel] Re: [PATCH v5 3/6] char: Let writers know how much data was written in case of errors List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Gerd Hoffmann Cc: Paul Brook , qemu list , Juan Quintela On (Tue) May 04 2010 [13:24:58], Gerd Hoffmann wrote: >> @@ -531,8 +534,12 @@ static int unix_write(int fd, const uint8_t *buf, int len1) >> while (len> 0) { >> ret = write(fd, buf, len); >> if (ret< 0) { >> - if (errno != EINTR&& errno != EAGAIN) >> + if (len1 - len) { >> + return len1 - len; >> + } >> + if (errno != EINTR&& errno != EAGAIN) { >> return -1; >> + } > > This makes unix_write pass -EINTR up to the caller which it didn't before. Only on partial writes. Should be OK, no? Amit