aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@linux.intel.com>2012-05-12 15:36:47 -0700
committerH. Peter Anvin <hpa@linux.intel.com>2012-05-12 15:38:42 -0700
commit8925a551fc3d0216433c7609a1f272f877619b6b (patch)
tree9e046f0bc3b349c6a491ba66d4883cec2ae475a4
parent0ba9a8316ad201053e32dbdbbd68da5edfe5230d (diff)
downloadklibc-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.c9
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);
}