diff options
Diffstat (limited to 'sysdeps/posix/ttyname.c')
-rw-r--r-- | sysdeps/posix/ttyname.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/sysdeps/posix/ttyname.c b/sysdeps/posix/ttyname.c index b0650b38b0..7c7ed2428a 100644 --- a/sysdeps/posix/ttyname.c +++ b/sysdeps/posix/ttyname.c @@ -44,6 +44,9 @@ DEFUN(ttyname, (fd), int fd) struct dirent *d; int save = errno; + if (!__isatty (fd)) + return NULL; + if (fstat (fd, &st) < 0) return NULL; mydev = st.st_dev; |