summaryrefslogtreecommitdiff
path: root/libc
diff options
context:
space:
mode:
authorBernhard Reutner-Fischer <rep.dot.nop@gmail.com>2008-11-09 13:13:05 +0000
committerBernhard Reutner-Fischer <rep.dot.nop@gmail.com>2008-11-09 13:13:05 +0000
commitfc78e7871ef27618239845e9383c628521935df8 (patch)
tree596721f0b20393391d47ceaa07c69bda8f42b8d8 /libc
parenta318a42dcdd361b828a030322c231577490f2ae1 (diff)
- for !UNIX98PTY_ONLY we have to fallback to old-style pty's.
Closes #6024
Diffstat (limited to 'libc')
-rw-r--r--libc/stdlib/getpt.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/libc/stdlib/getpt.c b/libc/stdlib/getpt.c
index 37ba78ab1..5b067438f 100644
--- a/libc/stdlib/getpt.c
+++ b/libc/stdlib/getpt.c
@@ -108,6 +108,11 @@ posix_openpt (int flags)
return -1;
}
}
+#if !defined __UNIX98PTY_ONLY__ && defined __UCLIBC_HAS_GETPT__
+ /* If we have no ptmx then ignore flags and use the fallback. */
+ if (_state & have_no_dev_ptmx)
+ return __bsd_getpt();
+#endif
return -1;
}
libc_hidden_def(posix_openpt)
@@ -115,18 +120,12 @@ libc_hidden_def(posix_openpt)
#undef devpts_mounted
#if defined __USE_GNU && defined __UCLIBC_HAS_GETPT__
-int
-getpt (void)
+int getpt (void)
{
- int fd = posix_openpt(O_RDWR);
-#if !defined __UNIX98PTY_ONLY__
- if (fd == -1)
- fd = __bsd_getpt();
-#endif
- return fd;
+ return posix_openpt(O_RDWR);
}
-#if !defined __UNIX98PTY_ONLY__
+#if !defined __UNIX98PTY_ONLY__ && defined __UCLIBC_HAS_GETPT__
# define PTYNAME1 "pqrstuvwxyzabcde";
# define PTYNAME2 "0123456789abcdef";