From: Nikodemus Siivola Date: Thu, 4 Aug 2011 10:31:06 +0000 (+0300) Subject: fix short writes when not using SERVE-EVENT X-Git-Url: http://repo.macrolet.net/gitweb/?a=commitdiff_plain;h=40269d0ac711b36151bec69db7a021a28cef41ee;p=sbcl.git fix short writes when not using SERVE-EVENT 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. --- diff --git a/NEWS b/NEWS index cb8226b..44a2f04 100644 --- 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 diff --git a/src/code/fd-stream.lisp b/src/code/fd-stream.lisp index a759017..7fda172 100644 --- a/src/code/fd-stream.lisp +++ b/src/code/fd-stream.lisp @@ -291,9 +291,9 @@ (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)