projects
/
musl
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
increase default thread stack/guard size
[musl]
/
src
/
unistd
/
isatty.c
diff --git
a/src/unistd/isatty.c
b/src/unistd/isatty.c
index
c8badaf
..
75a9c18
100644
(file)
--- a/
src/unistd/isatty.c
+++ b/
src/unistd/isatty.c
@@
-1,9
+1,13
@@
#include <unistd.h>
#include <unistd.h>
+#include <errno.h>
#include <sys/ioctl.h>
#include "syscall.h"
int isatty(int fd)
{
struct winsize wsz;
#include <sys/ioctl.h>
#include "syscall.h"
int isatty(int fd)
{
struct winsize wsz;
- return !__syscall(SYS_ioctl, fd, TIOCGWINSZ, &wsz);
+ unsigned long r = syscall(SYS_ioctl, fd, TIOCGWINSZ, &wsz);
+ if (r == 0) return 1;
+ if (errno != EBADF) errno = ENOTTY;
+ return 0;
}
}