This is the mail archive of the glibc-bugs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug libc/13253] fileno(3) crashes when passed NULL argument


http://sourceware.org/bugzilla/show_bug.cgi?id=13253

Rich Felker <bugdal at aerifal dot cx> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bugdal at aerifal dot cx

--- Comment #2 from Rich Felker <bugdal at aerifal dot cx> 2011-10-04 20:48:34 UTC ---
The part about needing to return -1 instead of EOF is correct but irrelevant
since EOF is always defined as -1. This would only matter on odd
implementations that define EOF as some negative value other than -1, of which
glibc is not an example.

There is definitely no requirement that fileno detect and return an error in
the case where an invalid pointer is passed to it. This report could be
reclassified as a bug in the manual, which is using really ambiguous and
misleading language ("in case [it] detects...it must"). Note that no version of
the POSIX standard requires any such detection or uses the word "must" or
"shall". Rather:

The fileno() function may fail if:

[EBADF] The stream argument is not a valid stream, or the stream is not
associated with a file.

Note that the word "may", not "shall", is used, indicating an optional error.
The more likely situation where EBADF may be returned is when the stream
argument refers to a memory stream or some other type of stream not associated
with a file descriptor.

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]