summaryrefslogtreecommitdiff
path: root/ext/pty
diff options
context:
space:
mode:
authornaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-11-08 02:03:57 +0000
committernaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-11-08 02:03:57 +0000
commitce19ae0ef0f830ad1781568abd097b9fb7ec0169 (patch)
treeb4959259945f1448eabe29a07fe9350fd6bdb01d /ext/pty
parentbd3b3c1b51a7d6ca50d9391d77c5ef618166caa3 (diff)
* ext/pty/pty.c (get_device_once): FreeBSD's posix_openpt doesn't
support O_CLOEXEC and fails if specified. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33665 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/pty')
-rw-r--r--ext/pty/pty.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/ext/pty/pty.c b/ext/pty/pty.c
index 353e1fa78f..fafc2c55dd 100644
--- a/ext/pty/pty.c
+++ b/ext/pty/pty.c
@@ -299,10 +299,11 @@ get_device_once(int *master, int *slave, char SlaveName[DEVICELEN], int nomesg,
rb_fd_fix_cloexec(masterfd);
#else
flags = O_RDWR|O_NOCTTY;
-# ifdef O_CLOEXEC
+# if defined(O_CLOEXEC) && !defined(__FreeBSD__)
/* glibc posix_openpt() in GNU/Linux calls open("/dev/ptmx", flags) internally.
* So version dependency on GNU/Linux is same as O_CLOEXEC with open().
- * O_CLOEXEC is available since Linux 2.6.23. Linux 2.6.18 silently ignore it. */
+ * O_CLOEXEC is available since Linux 2.6.23. Linux 2.6.18 silently ignore it.
+ * FreeBSD's posix_openpt doesn't support O_CLOEXEC and fails if specified*/
flags |= O_CLOEXEC;
# endif
if ((masterfd = posix_openpt(flags)) == -1) goto error;