Opened 4 years ago
Last modified 4 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:fdIS a valid file descriptor,EINVALis returned (which is a positive integer),fdIS NOT a valid file descriptor,fstat's-1is returned andEBADFis set by thefstatcall.assuming that
__libc_fstatbehaves 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).