bug-gnulib
[Top][All Lists]
Advanced

[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:41:25 -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:21 AM, Bruno Haible wrote:
> Eric Blake wrote:
>> +  /* We only need to flush the file if it is not reading or if it is
>> +     seekable.  */
>> +  if ((!freading (fp) || fseeko (fp, 0, SEEK_CUR) == 0) && fflush (fp))
> 
> Would it be equivalent to do
> 
>      if ((!freading (fp) || ftello (fp) != -1) && fflush (fp))

Or even lseek(fileno(fp),0,SEEK_CUR) != -1.

I'll test those options.

-- 
Eric Blake   address@hidden    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]