aboutsummaryrefslogtreecommitdiff
path: root/sysdeps/unix/bsd/ptsname.c
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>2002-09-20 20:18:24 +0000
committerRoland McGrath <roland@gnu.org>2002-09-20 20:18:24 +0000
commitdab9837091a70e6ed6ea0d6474e0508ea6fccde5 (patch)
treead85a1ef0fc8260ba148db194e630166754d18f9 /sysdeps/unix/bsd/ptsname.c
parentfcdc67f963a44603553e52a0f883e5d0e5727b34 (diff)
downloadglibc-dab9837091a70e6ed6ea0d6474e0508ea6fccde5.zip
glibc-dab9837091a70e6ed6ea0d6474e0508ea6fccde5.tar.gz
glibc-dab9837091a70e6ed6ea0d6474e0508ea6fccde5.tar.bz2
* sysdeps/unix/bsd/bsd4.4/isatty.c: New file.
* sysdeps/unix/bsd/isatty.c (__isatty): Don't save and restore errno. * sysdeps/unix/bsd/ptsname.c (__ptsname_r): Return errno value from isatty unmodified. Reported by Bruno Haible <bruno@clisp.org>.
Diffstat (limited to 'sysdeps/unix/bsd/ptsname.c')
-rw-r--r--sysdeps/unix/bsd/ptsname.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/sysdeps/unix/bsd/ptsname.c b/sysdeps/unix/bsd/ptsname.c
index cd7c42f..fd446a4 100644
--- a/sysdeps/unix/bsd/ptsname.c
+++ b/sysdeps/unix/bsd/ptsname.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998 Free Software Foundation, Inc.
+/* Copyright (C) 1998,2002 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -53,22 +53,20 @@ __ptsname_r (int fd, char *buf, size_t buflen)
}
if (!__isatty (fd))
- {
- __set_errno (ENOTTY);
- return ENOTTY;
- }
+ /* We rely on isatty to set errno properly (i.e. EBADF or ENOTTY). */
+ return errno;
if (buflen < strlen (_PATH_TTY) + 3)
{
__set_errno (ERANGE);
return ERANGE;
}
-
+
if (__ttyname_r (fd, buf, buflen) != 0)
return errno;
buf[sizeof (_PATH_DEV) - 1] = 't';
-
+
if (__stat (buf, &st) < 0)
return errno;