diff options
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | ext/pty/pty.c | 5 |
2 files changed, 8 insertions, 2 deletions
@@ -1,3 +1,8 @@ +Tue Nov 8 11:01:04 2011 NARUSE, Yui <naruse@ruby-lang.org> + + * ext/pty/pty.c (get_device_once): FreeBSD's posix_openpt doesn't + support O_CLOEXEC and fails if specified. + Mon Nov 7 22:03:47 2011 Tanaka Akira <akr@fsij.org> * ext/gdbm/gdbm.c (fgdbm_initialize): set close-on-exec flag. 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; |