improve error handling of ttyname_r and isatty
authorBenjamin Peterson <benjamin@python.org>
Thu, 13 Sep 2018 21:23:42 +0000 (14:23 -0700)
committerRich Felker <dalias@aerifal.cx>
Sat, 15 Sep 2018 05:58:03 +0000 (01:58 -0400)
commitc84971995b3a6d5118f9357c040572f4c78bcd55
tree36b663dffd83bc09199d01f34f77126167c71ccb
parente13063aad7aee341d278d2a879a76ec7b59b2ad8
improve error handling of ttyname_r and isatty

POSIX allows ttyname(_r) and isatty to return EBADF if passed file
descriptor is invalid.

maintainer's note: these are optional ("may fail") errors, but it's
non-conforming for ttyname_r to return ENOTTY when it failed for a
different reason.
src/unistd/isatty.c
src/unistd/ttyname_r.c