* Ed Schouten <[email protected]>, 20111012 20:56:
> The attached patch should fix this.

Hmmm... I seem to remember you folks prefer to have the Signed-off-by
tag in the commit message. I've attached a new patch.

-- 
 Ed Schouten <[email protected]>
 WWW: http://80386.nl/
From e599ea2515e9eda2d35b72431df5569f2b99f318 Mon Sep 17 00:00:00 2001
From: Ed Schouten <[email protected]>
Date: Wed, 12 Oct 2011 20:53:21 +0200
Subject: [PATCH] Add support for posix_openpt().

Instead of opening /dev/ptmx directly, we should use the proper
posix_openpt() function to obtain a pseudo-terminal. Some operating
systems, such as FreeBSD 8 and later, implement pseudo-terminal master
device nodes as a special file descriptor type, like sockets. They do
not support creation of pseudo-terminals through /dev/ptmx.

Signed-off-by: Ed Schouten <[email protected]>
---
 configure.ac |    2 +-
 sys.c        |    4 ++++
 2 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/configure.ac b/configure.ac
index c3cd947..e9a5984 100644
--- a/configure.ac
+++ b/configure.ac
@@ -38,7 +38,7 @@ AC_CANONICAL_HOST
 
 
 AC_CHECK_HEADERS([pty.h stropts.h sys/param.h sys/select.h])
-AC_CHECK_FUNCS([select grantpt])
+AC_CHECK_FUNCS([select grantpt posix_openpt])
 
 AC_ARG_WITH(localealiasfile,
         AS_HELP_STRING([--with-localealiasfile=<path>],
diff --git a/sys.c b/sys.c
index 804bdbb..8463b05 100644
--- a/sys.c
+++ b/sys.c
@@ -335,7 +335,11 @@ allocatePty(int *pty_return, char **line_return)
 #if defined(HAVE_GRANTPT)
     int rc;
 
+#ifdef HAVE_POSIX_OPENPT
+    pty = posix_openpt(O_RDWR);
+#else
     pty = open("/dev/ptmx", O_RDWR);
+#endif
     if (pty < 0)
 	goto bsd;
 
-- 
1.7.7

Attachment: pgpHY4Ec4nyAX.pgp
Description: PGP signature

_______________________________________________
[email protected]: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

Reply via email to