about summary refs log tree commit diff
path: root/sysdeps
diff options
context:
space:
mode:
authorSamuel Thibault <samuel.thibault@ens-lyon.org>2020-11-13 23:51:49 +0000
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2020-11-14 00:54:08 +0100
commitb4fcf0475b579d682b2be62fbfed0a286ac64bf3 (patch)
tree1ca3010a3395d763119af933b721b888db9f8b38 /sysdeps
parent3b13266f14641d8e956e888237df1da6f80fbc1b (diff)
downloadglibc-b4fcf0475b579d682b2be62fbfed0a286ac64bf3.tar.gz
glibc-b4fcf0475b579d682b2be62fbfed0a286ac64bf3.tar.xz
glibc-b4fcf0475b579d682b2be62fbfed0a286ac64bf3.zip
hurd: make ptsname fail with ENOTTY on non-master-pty
Diffstat (limited to 'sysdeps')
-rw-r--r--sysdeps/mach/hurd/ptsname.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/sysdeps/mach/hurd/ptsname.c b/sysdeps/mach/hurd/ptsname.c
index 065ba2a268..2bcbe7b03f 100644
--- a/sysdeps/mach/hurd/ptsname.c
+++ b/sysdeps/mach/hurd/ptsname.c
@@ -46,6 +46,14 @@ __ptsname_internal (int fd, char *buf, size_t buflen, struct stat64 *stp)
   string_t peername;
   size_t len;
   error_t err;
+  int ttype;
+
+  if (HURD_DPORT_USE (fd, __term_get_bottom_type (port, &ttype)) == 0)
+    {
+      /* get_bottom_type suceeded, this is the slave side.  */
+      errno = ENOTTY;
+      return ENOTTY;
+    }
 
   if (err = HURD_DPORT_USE (fd, __term_get_peername (port, peername)))
     {