...
Non-Compliant Coding Example
Many implementations of the stdio package adjust their behavior slightly if stdout
is a terminal. To make the determination, these implementations perform some operation which happens to fail (with ENOTTY
) if stdout is not a terminal. Although the output operation goes on to complete successfully, errno
still contains ENOTTY
. This behavior can be mildly confusing, but it is not strictly incorrect, because it is only meaningful for a program to inspect the contents of errno after an error has been reported. (More precisely, errno is only meaningful after a library function that sets errno
on error has returned an error code.)
...