Opened 3 years ago
Last modified 3 years ago
#118 new defect
libc: isatty(3) is POSIX-nonconformant
Reported by: | Lukáš Zaoral | Owned by: | |
---|---|---|---|
Priority: | major | Milestone: | 4.5 |
Component: | DiOS | Keywords: | |
Cc: | kdudka@…, lzaoral@… |
Description
The current implementation of isatty(3)
in DiOS returns EINVAL
if fd
is a valid file descriptor (assuming that __libc_fstat
behaves as fstat(2)
) or returns 0
if it is not.
This contradicts the POSIX manual page as the only valid return values are 1
or 0
with set errno
.
Note: See
TracTickets for help on using
tickets.
Sorry for the confusion, I've misunderstood the piece of code. The actual behaviour of DiOS'
isatty(3)
is hopefully the following:fd
IS a valid file descriptor,EINVAL
is returned (which is a positive integer),fd
IS NOT a valid file descriptor,fstat
's-1
is returned andEBADF
is set by thefstat
call.assuming that
__libc_fstat
behaves asfstat(2)
. This is, however, still a violation of the POSIX standard that can make some parts of the program falsely unreachable by Divine (mainly if there is a comparison of the return value for equality with zero).