qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] Re: [PATCH v5 3/6] char: Let writers know how much data was


From: Gerd Hoffmann
Subject: [Qemu-devel] Re: [PATCH v5 3/6] char: Let writers know how much data was written in case of errors
Date: Tue, 04 May 2010 15:30:56 +0200
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.9) Gecko/20100330 Fedora/3.0.4-1.fc12 Thunderbird/3.0.4

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





reply via email to

[Prev in Thread] Current Thread [Next in Thread]