[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] fclose: don't fail on non-seekable input stream
From: |
Eric Blake |
Subject: |
Re: [PATCH] fclose: don't fail on non-seekable input stream |
Date: |
Mon, 02 May 2011 08:40:35 -0600 |
User-agent: |
Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.17) Gecko/20110428 Fedora/3.1.10-1.fc14 Lightning/1.0b3pre Mnenhy/0.8.3 Thunderbird/3.1.10 |
On 05/01/2011 04:38 AM, Bruno Haible wrote:
> In fact, the dependency on 'fflush' should not be needed, because the fixes
> of that module are not relevant here:
>
> ! Portability problems fixed by Gnulib:
> ! @itemize
> ! @item
> ! @code{fflush} followed by @code{fseek} or @code{fseeko}, applied to an input
> ! stream, should have the effect of positioning the underlying file
> descriptor.
> ! It doesn't do this on some platforms.
>
> Not relevant, because after the fflush() comes an fclose().
Actually quite relevant - we _have_ to ensure that before the fclose
that the underlying position of a seekable input file is in the right
position.
>
> ! @item
> ! @code{fflush} on an input stream changes the position of the stream to the
> ! end of the previous buffer, on some platforms: mingw.
>
> Likewise not relevant: the position of the stream is irrelevant in fclose().
Yes it is. test-closein has a test that validates that:
{ test-closein consume; cat; } < file
outputs the remainder of file after the 6 bytes consumed by test-closein.
>
> ! @item
> ! @code{fflush} on an input stream right after @code{ungetc} does not discard
> ! the @code{ungetc} buffer, on some platforms:
> ! MacOS X 10.5, FreeBSD 6.0, NetBSD 5.0, OpenBSD 3.8, Cygwin 1.5.25-10.
>
> Likewise not relevant, because no ungetc will occur between fflush() and
> the fclose() that follows it.
>
> So, the remaining added dependency is 'freading'. lib/stdio-impl.h is already
> under LGPLv2+ (as part of the modules freadahead, freadptr, freadseek, fseeko,
> ftello). lib/freading.c was under LGPLv2+ until 2007-10-07 and since then
> only modified by me and Eric. I'm willing to relicense my changes unter
> LGPLv2+.
> Eric?
Yes, I'm willing to relax the license.
--
Eric Blake address@hidden +1-801-349-2682
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature