From ce19ae0ef0f830ad1781568abd097b9fb7ec0169 Mon Sep 17 00:00:00 2001 From: naruse Date: Tue, 8 Nov 2011 02:03:57 +0000 Subject: * 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 --- ext/pty/pty.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'ext/pty/pty.c') 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; -- cgit v1.2.3