On Wed, 2010-02-03 at 10:25:49 -0600, Jonathan Nieder wrote: > Guillem Jover wrote: > > The EINTR, EAGAIN, EWOULDBLOCK errors seem to be safe to be handled now > > with gzclearerr, as there's no possibility of a partial fread/fwrite > > returning with those anymore. > > write() still can, no? > > From gz_comp(), it seems the length of partial writes are still > sometimes forgotten: > > if (have && write(state->fd, state->next, have) != have) { > gz_error(state, Z_ERRNO, zstrerror()); > return -1; > }
When interrupted or on non-blocking mode write(2) can either return > 0 (possibly a partial write) or -1 with any of those error codes, but it should never return with a partial write and errno set to any of those, which is possible with fwrite (as internally it might be doing several write(2) calls and the last one might fail with any of those errors). So in the gz_comp case as long as the write returns -1 and never does a partial write it's fine to restart it. OTOH if it's a partial write errno will be bogus. regards, guillem -- To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org