bug-diffutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [bug-diffutils] Funny behaviour of diff 2.8.1


From: Eric Blake
Subject: Re: [bug-diffutils] Funny behaviour of diff 2.8.1
Date: Fri, 20 Aug 2010 14:16:10 -0600
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.8) Gecko/20100805 Red Hat/3.1.2-2.el6 Mnenhy/0.8.3 Thunderbird/3.1.2

On 08/20/2010 02:12 PM, Paul Eggert wrote:
> On 08/20/10 15:38, Eric Blake wrote:
>> freopen(NULL,"wb",stdout) has implementation-defined effects
> 
> That's true for the C standard, but POSIX is reasonably specific
> about the fact that changing a file's mode from "w" to "wb" is
> not a change at all,

Maybe so, but POSIX is still quite clear that passing a NULL pointer
instead of a filename is implementation defined:
http://www.opengroup.org/onlinepubs/9699919799/functions/freopen.html

If filename is a null pointer, the freopen() function shall attempt to
change the mode of the stream to that specified by mode, as if the name
of the file currently associated with the stream had been used. In this
case, the file descriptor associated with the stream need not be closed
if the call to freopen() succeeds. It is implementation-defined which
changes of mode are permitted (if any), and under what circumstances.


> and that no file descriptors need to be
> opened, duped, or allocated in order to perform this non-change.

None need be opened, but likewise the implementation is not forbidden
from forbidding all mode changes in all cases, in which case the
implementation is free to document that passing a NULL first argument
will never succeed.

-- 
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]