From 0ea40b2294e162c0183ba3ed07b186a4499fe082 Mon Sep 17 00:00:00 2001 From: naruse Date: Sat, 25 May 2013 12:34:50 +0000 Subject: [PATCH] * ext/pty/pty.c (get_device_once): FreeBSD 10-current and 9-stable added O_CLOEXEC support to posix_openpt, so assume FreeBSD 9.2 or later supports it. http://www.freebsd.org/cgi/query-pr.cgi?pr=162374 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40928 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 7 +++++++ ext/pty/pty.c | 8 ++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index b874e117ee..815d6fcab1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +Sat May 25 21:29:34 2013 NARUSE, Yui + + * ext/pty/pty.c (get_device_once): FreeBSD 10-current and 9-stable + added O_CLOEXEC support to posix_openpt, so assume FreeBSD 9.2 or + later supports it. + http://www.freebsd.org/cgi/query-pr.cgi?pr=162374 + Sat May 25 18:46:23 2013 Yusuke Endoh * proc.c (rb_method_entry_min_max_arity): fix missing break in switch. diff --git a/ext/pty/pty.c b/ext/pty/pty.c index 5986a8d4ba..20b2cc09cd 100644 --- a/ext/pty/pty.c +++ b/ext/pty/pty.c @@ -22,6 +22,10 @@ #ifdef HAVE_PTY_H #include #endif +#if defined(HAVE_SYS_PARAM_H) + /* for __FreeBSD_version */ +# include +#endif #ifdef HAVE_SYS_WAIT_H #include #else @@ -228,9 +232,9 @@ get_device_once(int *master, int *slave, char SlaveName[DEVICELEN], int nomesg, dfl.sa_flags = 0; sigemptyset(&dfl.sa_mask); -#if defined(__sun) || defined(__FreeBSD__) +#if defined(__sun) || (defined(__FreeBSD__) && __FreeBSD_version < 902000) /* workaround for Solaris 10: grantpt() doesn't work if FD_CLOEXEC is set. [ruby-dev:44688] */ - /* FreeBSD 8 supported O_CLOEXEC for posix_openpt, but FreeBSD 9 removed it. + /* FreeBSD 9.2 or later supports O_CLOEXEC * http://www.freebsd.org/cgi/query-pr.cgi?pr=162374 */ if ((masterfd = posix_openpt(O_RDWR|O_NOCTTY)) == -1) goto error; if (sigaction(SIGCHLD, &dfl, &old) == -1) goto error;