From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1O9GH4-0000ao-Qe for qemu-devel@nongnu.org; Tue, 04 May 2010 07:26:50 -0400 Received: from [140.186.70.92] (port=58665 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1O9GH2-0000JE-Jc for qemu-devel@nongnu.org; Tue, 04 May 2010 07:26:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1O9GFS-00057d-CM for qemu-devel@nongnu.org; Tue, 04 May 2010 07:25:11 -0400 Received: from mx1.redhat.com ([209.132.183.28]:47640) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1O9GFS-00057K-56 for qemu-devel@nongnu.org; Tue, 04 May 2010 07:25:10 -0400 Message-ID: <4BE0040A.3020906@redhat.com> Date: Tue, 04 May 2010 13:24:58 +0200 From: Gerd Hoffmann MIME-Version: 1.0 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> In-Reply-To: <1272970367-24647-4-git-send-email-amit.shah@redhat.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit 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: Amit Shah Cc: Paul Brook , qemu list , Juan Quintela > @@ -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. cheers, Gerd