Bladeren bron

Correction if UNIX98PTY_ONLY is not enabled

Peter S. Mazinger 18 jaren geleden
bovenliggende
commit
42dfe0465e
2 gewijzigde bestanden met toevoegingen van 8 en 5 verwijderingen
  1. 4 2
      libc/stdlib/bsd_getpt.c
  2. 4 3
      libc/stdlib/getpt.c

+ 4 - 2
libc/stdlib/bsd_getpt.c

@@ -22,6 +22,8 @@
 #include <string.h>
 #include <unistd.h>
 
+libc_hidden_proto(open)
+libc_hidden_proto(mempcpy)
 
 /* Prefix for master pseudo terminal nodes.  */
 #define _PATH_PTY "/dev/pty"
@@ -48,7 +50,7 @@ __getpt (void)
   const char *p, *q;
   char *s;
 
-  s = __mempcpy (buf, _PATH_PTY, sizeof (_PATH_PTY) - 1);
+  s = mempcpy (buf, _PATH_PTY, sizeof (_PATH_PTY) - 1);
   /* s[0] and s[1] will be filled in the loop.  */
   s[2] = '\0';
 
@@ -62,7 +64,7 @@ __getpt (void)
 
 	  s[1] = *q;
 
-	  fd = __open (buf, O_RDWR);
+	  fd = open (buf, O_RDWR);
 	  if (fd != -1)
 	    return fd;
 

+ 4 - 3
libc/stdlib/getpt.c

@@ -17,12 +17,16 @@
    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
    02111-1307 USA.  */
 
+#define _GNU_SOURCE
 #include <errno.h>
 #include <fcntl.h>
 #include <stdlib.h>
 #include <unistd.h>
 #include <paths.h>
 
+libc_hidden_proto(open)
+libc_hidden_proto(close)
+
 #if !defined __ASSUME_DEVPTS__
 # include <sys/statfs.h>
 
@@ -42,9 +46,6 @@
 extern int __bsd_getpt (void) attribute_hidden;
 #endif
 
-libc_hidden_proto(open)
-libc_hidden_proto(close)
-
 /* Open a master pseudo terminal and return its file descriptor.  */
 int
 getpt (void)