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:
authorJeff Johnston <jjohnstn@redhat.com>2008-11-19 23:56:22 +0300
committerJeff Johnston <jjohnstn@redhat.com>2008-11-19 23:56:22 +0300
commit8ee939ea9f395f95357612d64d9be8e9a6529e46 (patch)
tree69f67c24be31e64b3973adbbacef499e6f753299 /newlib/libc/posix/_isatty.c
parente231c7dae90002f4aa9a6e8bdb445a0bd6c392ae (diff)
2008-11-19 Jeff Johnston <jjohnstn@redhat.com>
* libc/sys/linux/bits/dirent.h: New header file. * libc/sys/linux/sys/dirent.h: Include <bits/dirent.h> instead of <linux/dirent.h>. * libc/posix/Makefile.am: Remove reallocf. * libc/posix/Makefile.in: Regenerated. * libc/posix/reallocf.c: Moved to... * libc/stdlib/reallocf.c: Here * libc/stdlib/malloc.c: Add reallocf documentation. * libc/include/stdlib.h: Add reallocf and _reallocf_r prototypes. * libc/stdlib/Makefile.am: Add reallocf. * libc/stdlib/Makefile.in: Regenerated. * libc/posix/_isatty.c: Set errno.
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;
}