From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1O9IDY-0000W5-4G for qemu-devel@nongnu.org; Tue, 04 May 2010 09:31:20 -0400 Received: from [140.186.70.92] (port=37016 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1O9IDT-0000Kc-Ay for qemu-devel@nongnu.org; Tue, 04 May 2010 09:31:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1O9IDR-00006B-PQ for qemu-devel@nongnu.org; Tue, 04 May 2010 09:31:15 -0400 Received: from mx1.redhat.com ([209.132.183.28]:16731) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1O9IDR-00005i-Hw for qemu-devel@nongnu.org; Tue, 04 May 2010 09:31:13 -0400 Message-ID: <4BE02190.4020603@redhat.com> Date: Tue, 04 May 2010 15:30:56 +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> <4BE0040A.3020906@redhat.com> <20100504113151.GD8136@amit-x200.redhat.com> In-Reply-To: <20100504113151.GD8136@amit-x200.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 On 05/04/10 13:31, Amit Shah wrote: > 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? No. Callers which never saw partial writes due to write() syscall being interrupted by some signal start seeing them now. cheers, Gerd