diff options
author | H. Peter Anvin <hpa@linux.intel.com> | 2012-05-12 15:36:47 -0700 |
---|---|---|
committer | H. Peter Anvin <hpa@linux.intel.com> | 2012-05-12 15:38:42 -0700 |
commit | 8925a551fc3d0216433c7609a1f272f877619b6b (patch) | |
tree | 9e046f0bc3b349c6a491ba66d4883cec2ae475a4 | |
parent | 0ba9a8316ad201053e32dbdbbd68da5edfe5230d (diff) | |
download | klibc-8925a551fc3d0216433c7609a1f272f877619b6b.tar.gz |
[klibc] isatty: allow errno to be set
The specification for isatty() *does* specify that errno is set if the
file descriptor is not a terminal. Since we also have to propagate
errors on real errors (e.g. EBADF) this makes the implementation
really simple...
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
-rw-r--r-- | usr/klibc/isatty.c | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/usr/klibc/isatty.c b/usr/klibc/isatty.c index b4a84b726f3943..c2e4a4ea7fba37 100644 --- a/usr/klibc/isatty.c +++ b/usr/klibc/isatty.c @@ -8,13 +8,8 @@ int isatty(int fd) { - int old_errno = errno; - int istty; - pid_t dummy; + int dummy; /* All ttys support TIOCGPGRP */ - istty = !ioctl(fd, TIOCGPGRP, &dummy); - errno = old_errno; - - return istty; + return !ioctl(fd, TIOCGPGRP, &dummy); } |