[PATCH 1/6] Don't hang if something goes wrong reading from a tar archive

Corinna Vinschen corinna-cygwin@cygwin.com
Wed Apr 20 08:42:00 GMT 2011


On Apr  8 15:43, Jon TURNEY wrote:
> Returning EIO (a small positive integer) as the result of archive_tar_file::read()
> on an error isn't a good idea, it's indistinguishable from successfully reading
> a small number of bytes.
> 
> This causes io_stream::copy() to spin forever if it's reading from an archive stream
> which terminates unexpectedly early, which can happen on an decompression error.
> 
> So, return -1 and set lasterr instead.  This matches the behaviour of POSIX
> read(), so shouldn't surprise anyone :-)
> 
> Make the same change for archive_tar_file::write(), archive_tar_file::tell()
> and archive_tar_file::peek() for consistency
> 
> 2011-04-08  Jon TURNEY  <...>
> 
> 	* archive_tar_file.cc (read, write, peek, seek): Consistently return -1
> 	and set lasterr on an error.

Please commit.


Thanks,
Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Project Co-Leader          cygwin AT cygwin DOT com
Red Hat



More information about the Cygwin-apps mailing list