From 40d3b0ed787a638ef96f016f9050fb64d5c90117 Mon Sep 17 00:00:00 2001
From: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
Date: Sat, 7 Jun 2008 14:51:43 +0000
Subject: - revert incorrect parts of r22257 and 22259   since posix_openpt
 lives in getpt.c it has to stay there unconditionally.

---
 libc/stdlib/Makefile.in | 5 +----
 libc/stdlib/bsd_getpt.c | 4 ++--
 libc/stdlib/getpt.c     | 4 +++-
 3 files changed, 6 insertions(+), 7 deletions(-)

(limited to 'libc')

diff --git a/libc/stdlib/Makefile.in b/libc/stdlib/Makefile.in
index 2f628362c..dfef6d18e 100644
--- a/libc/stdlib/Makefile.in
+++ b/libc/stdlib/Makefile.in
@@ -12,7 +12,7 @@ include $(top_srcdir)libc/stdlib/malloc-standard/Makefile.in
 CSRC := \
 	abort.c getenv.c mkdtemp.c mktemp.c realpath.c mkstemp.c \
 	rand.c random.c random_r.c setenv.c system.c div.c ldiv.c lldiv.c \
-	drand48-iter.c jrand48.c \
+	getpt.c drand48-iter.c jrand48.c \
 	jrand48_r.c lrand48.c lrand48_r.c mrand48.c mrand48_r.c nrand48.c \
 	nrand48_r.c rand_r.c srand48.c srand48_r.c seed48.c seed48_r.c \
 	valloc.c a64l.c l64a.c __uc_malloc.c
@@ -22,9 +22,6 @@ endif
 ifeq ($(UCLIBC_HAS_PTY),y)
 CSRC += grantpt.c unlockpt.c ptsname.c
 endif
-ifeq ($(UCLIBC_HAS_GETPT),y)
-CSRC += getpt.c
-endif
 ifeq ($(UCLIBC_HAS_ARC4RANDOM),y)
 CSRC += arc4random.c
 endif
diff --git a/libc/stdlib/bsd_getpt.c b/libc/stdlib/bsd_getpt.c
index 9b93448bc..1afd57f47 100644
--- a/libc/stdlib/bsd_getpt.c
+++ b/libc/stdlib/bsd_getpt.c
@@ -22,13 +22,13 @@
 #include <string.h>
 #include <unistd.h>
 
+#if defined __USE_BSD
 libc_hidden_proto(open)
 /* Experimentally off - libc_hidden_proto(mempcpy) */
 
 /* Prefix for master pseudo terminal nodes.  */
 #define _PATH_PTY "/dev/pty"
 
-
 /* Letters indicating a series of pseudo terminals.  */
 #ifndef PTYNAME1
 #define PTYNAME1 "pqrsPQRS"
@@ -41,7 +41,6 @@ const char __libc_ptyname1[] attribute_hidden = PTYNAME1;
 #endif
 const char __libc_ptyname2[] attribute_hidden = PTYNAME2;
 
-
 /* Open a master pseudo terminal and return its file descriptor.  */
 int
 __getpt (void)
@@ -76,3 +75,4 @@ __getpt (void)
   __set_errno (ENOENT);
   return -1;
 }
+#endif /* __USE_BSD */
diff --git a/libc/stdlib/getpt.c b/libc/stdlib/getpt.c
index 950664509..1b5de7c16 100644
--- a/libc/stdlib/getpt.c
+++ b/libc/stdlib/getpt.c
@@ -45,7 +45,7 @@ libc_hidden_proto(close)
 /* Directory containing the UNIX98 pseudo terminals.  */
 #define _PATH_DEVPTS _PATH_DEV "pts"
 
-#if !defined __UNIX98PTY_ONLY__
+#if !defined __UNIX98PTY_ONLY__ && defined __UCLIBC_HAS_GETPT__
 /* Prototype for function that opens BSD-style master pseudo-terminals.  */
 extern int __bsd_getpt (void) attribute_hidden;
 #endif
@@ -106,6 +106,8 @@ posix_openpt (int flags)
     }
   return -1;
 }
+#undef have_no_dev_ptmx
+#undef devpts_mounted
 
 #if defined __USE_GNU && defined __UCLIBC_HAS_GETPT__
 int
-- 
cgit v1.2.3