fix short writes when not using SERVE-EVENT
authorNikodemus Siivola <nikodemus@sb-studio.net>
Thu, 4 Aug 2011 10:31:06 +0000 (13:31 +0300)
committerNikodemus Siivola <nikodemus@sb-studio.net>
Thu, 4 Aug 2011 10:38:17 +0000 (13:38 +0300)
  Regression since 1.0.42.43, lp#820599.

  Thanks to Robert Brown.

  If we remain in the loop, we need to update the local HEAD
  variable in the event of a short write.

  NOTE: No test case yet, as this is dependant on the size of kernel
  buffers, and trying to catch the short-write -case is tricky.

NEWS
src/code/fd-stream.lisp

diff --git a/NEWS b/NEWS
index cb8226b..44a2f04 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -18,6 +18,7 @@ changes relative to sbcl-1.0.50:
     (lp#549673)
   * bug fix: SSE comparison instructions can be disassembled even when one
     operand is in memory. (lp#814702)
+  * bug fix: incomplete writes when not using SERVE-EVENTS. (lp#820599)
 
 changes in sbcl-1.0.50 relative to sbcl-1.0.49:
   * enhancement: errors from FD handlers now provide a restart to remove
index a759017..7fda172 100644 (file)
                                (return (reset-buffer obuf)))
                               (count
                                ;; Partial write -- update buffer status and
-                               ;; queue or wait. Do not use INCF! Another
-                               ;; thread might have moved head...
-                               (setf (buffer-head obuf) (+ count head))
+                               ;; queue or wait.
+                               (incf head count)
+                               (setf (buffer-head obuf) head)
                                (queue-or-wait))
                               #!-win32
                               ((eql errno sb!unix:ewouldblock)