Jonathan Nieder wrote:
> Guillem Jover wrote:

>> 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.
>
> Ah, okay, so with "fast" devices (such as disks), it’s fine.
> 
> For "slow" devices such as pipes, it would be nice to report the
> partial writes.  If this causes the calling operation to fail, I am
> not sure what the right way to report this is.  If this happens in the
> middle of a block, fwrite() just tries to resume; but that is not
> always very good behavior.
> 
> Maybe this should be configurable via a new flag in the 'mode' string
> (e.g., 'B' for non-blocking)?

Agh, that would be dangerously backwards-incompatible.  With gzio,
the cleaned-up mode string was passed on to fopen.

Currently, a perfectly legitimate short write (for example, to a pipe)
can cause gzwrite to fail.  Fixing this properly would require adding
a flag and a function to set it, to decide whether to retry on short
reads and writes.

If we were starting from scratch, the best default would be _to_
retry.  But the backwards-compatible choice is to default to not
retrying.

Jonathan



-- 
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]

Reply via email to