commit-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[hurd, commited] hurd: make ptsname fail with ENOTTY on non-master-pty


From: Samuel Thibault
Subject: [hurd, commited] hurd: make ptsname fail with ENOTTY on non-master-pty
Date: Sat, 14 Nov 2020 00:54:16 +0100

---
 sysdeps/mach/hurd/ptsname.c | 8 ++++++++
 1 file changed, 8 insertions(+)

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)))
     {
-- 
2.29.2




reply via email to

[Prev in Thread] Current Thread [Next in Thread]