Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'newlib/libc/posix/_isatty.c')
-rw-r--r--newlib/libc/posix/_isatty.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/newlib/libc/posix/_isatty.c b/newlib/libc/posix/_isatty.c
index 7260211ef..7d6ccae7c 100644
--- a/newlib/libc/posix/_isatty.c
+++ b/newlib/libc/posix/_isatty.c
@@ -3,15 +3,19 @@
/* Dumb implementation so programs will at least run. */
#include <sys/stat.h>
+#include <errno.h>
int
_DEFUN(_isatty, (fd), int fd)
{
struct stat buf;
- if (fstat (fd, &buf) < 0)
+ if (fstat (fd, &buf) < 0) {
+ errno = EBADF;
return 0;
+ }
if (S_ISCHR (buf.st_mode))
return 1;
+ errno = ENOTTY;
return 0;
}