about summary refs log tree commit diff
path: root/sysdeps/mach/hurd/ptsname.c
diff options
context:
space:
mode:
authorSamuel Thibault <samuel.thibault@ens-lyon.org>2018-02-17 23:26:45 +0100
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2018-02-17 23:26:45 +0100
commitdd1efd8c56f6e54667d66b2302f9590736546414 (patch)
tree7b16672ab15d630fc4a84594a0be3ef1e44d1c5e /sysdeps/mach/hurd/ptsname.c
parent13768813bcec803e4d269dc597411804bb4c37b1 (diff)
downloadglibc-dd1efd8c56f6e54667d66b2302f9590736546414.tar.gz
glibc-dd1efd8c56f6e54667d66b2302f9590736546414.tar.xz
glibc-dd1efd8c56f6e54667d66b2302f9590736546414.zip
hurd: Fix build on missing __ptsname_internal function
	* sysdeps/mach/hurd/ptsname.c: Include <sys/stat.h>.
	(__ptsname_r): Move implementation to...
	(__ptsname_internal): ... new function.  Add filling the STP
	structure.
Diffstat (limited to 'sysdeps/mach/hurd/ptsname.c')
-rw-r--r--sysdeps/mach/hurd/ptsname.c23
1 files changed, 19 insertions, 4 deletions
diff --git a/sysdeps/mach/hurd/ptsname.c b/sysdeps/mach/hurd/ptsname.c
index 08748a36b2..5c1dc6e981 100644
--- a/sysdeps/mach/hurd/ptsname.c
+++ b/sysdeps/mach/hurd/ptsname.c
@@ -18,6 +18,7 @@
 
 #include <errno.h>
 #include <string.h>
+#include <sys/stat.h>
 #include <hurd.h>
 #include <hurd/fd.h>
 #include <hurd/term.h>
@@ -38,11 +39,9 @@ ptsname (int fd)
 }
 
 
-/* Store at most BUFLEN characters of the pathname of the slave pseudo
-   terminal associated with the master FD is open on in BUF.
-   Return 0 on success, otherwise an error number.  */
+/* We don't need STP, but fill it for conformity with the Linux version...  */
 int
-__ptsname_r (int fd, char *buf, size_t buflen)
+__ptsname_internal (int fd, char *buf, size_t buflen, struct stat64 *stp)
 {
   string_t peername;
   size_t len;
@@ -58,7 +57,23 @@ __ptsname_r (int fd, char *buf, size_t buflen)
       return ERANGE;
     }
 
+  if (stp)
+    {
+      if (__xstat64 (_STAT_VER, peername, stp) < 0)
+	return errno;
+    }
+
   memcpy (buf, peername, len);
   return 0;
 }
+
+
+/* Store at most BUFLEN characters of the pathname of the slave pseudo
+   terminal associated with the master FD is open on in BUF.
+   Return 0 on success, otherwise an error number.  */
+int
+__ptsname_r (int fd, char *buf, size_t buflen)
+{
+  return __ptsname_internal (fd, buf, buflen, NULL);
+}
 weak_alias (__ptsname_r, ptsname_r)