On Wed, Sep 02, 2009 at 03:48:46PM +0200, Sandro Serafini wrote:
>To fix this bug, you have to modify the 05_handle-short-read.dpatch
>patch, in this way:
>
>The THREE istance of (row number 58, 94, 133 of the
>05_handle-short-read.dpatch file):
>
>+          num_bytes += bytes_read;
>
>Should be modified in:
>
>+      if (bytes_read>0) num_bytes += bytes_read;
>
>Because when read returns error, this should not influence the number
>of bytes already read.
>
>AND
>
>The THREE istance of (row number 60, 96, 135 of the
>05_handle-short-read.dpatch file):
>
>+  while ((bytes_read > 0 || errno == EINTR) [...]
>
>Should be modified in:
>
>+  while ((bytes_read > 0 || (bytes_read==-1 && errno == EINTR)) [...]
>
>Because errno is only valid when read returns -1, errno is not set if
>there are no errors from the "read"; so if "read" gets interrupted by an
>EINTR, then when "read" reaches end-of-file, "read" will return 0
>with errno still set to EINTR, and the loop become an infinite loop.
>
>Please someone upstream the fix and inform the author of the patch,
>thanks!
>
>Sandro

Thank you Sandro for the fix.

Marcus and Artur, could you please test Sandro's fix for this bug?

Cheers!

Attachment: signature.asc
Description: Digital signature

Reply via email to