]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
hurd: Fix build on missing __ptsname_internal function
authorSamuel Thibault <samuel.thibault@ens-lyon.org>
Sat, 17 Feb 2018 22:26:45 +0000 (23:26 +0100)
committerSamuel Thibault <samuel.thibault@ens-lyon.org>
Sat, 17 Feb 2018 22:26:45 +0000 (23:26 +0100)
* sysdeps/mach/hurd/ptsname.c: Include <sys/stat.h>.
(__ptsname_r): Move implementation to...
(__ptsname_internal): ... new function.  Add filling the STP
structure.

ChangeLog
sysdeps/mach/hurd/ptsname.c

index fdf0e469bb0f0c92b688ae066510acfecc8e854d..4e8411f9bf7401312971fa41d68de84e17685c27 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -3,6 +3,10 @@
        * mach/Makefile (headers): Add mach/param.h.
        * sysdeps/mach/hurd/bits/param.h: Include <mach/param.h>.
        * sysdeps/mach/i386/mach/param.h: New file, defines EXEC_PAGESIZE
+       * sysdeps/mach/hurd/ptsname.c: Include <sys/stat.h>.
+       (__ptsname_r): Move implementation to...
+       (__ptsname_internal): ... new function.  Add filling the STP
+       structure.
 
 2018-02-17  John David Anglin  <danglin@gcc.gnu.org>
 
index 08748a36b2b233ac7305a6f550ba67a81c072c0f..5c1dc6e98156380b9078275902ec72bd328e6564 100644 (file)
@@ -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)