From: ben Date: Tue, 2 Oct 2007 21:07:52 +0000 (+0000) Subject: As far as I can see (at least in NetBSD) O_NONBLOCK and FIONBIO are equivalent, X-Git-Url: https://git.distorted.org.uk/u/mdw/putty/commitdiff_plain/f98b826007692d62a286b12c0360617480828d02 As far as I can see (at least in NetBSD) O_NONBLOCK and FIONBIO are equivalent, except that O_NONBLOCK is standardised and FIONBIO isn't. In consequence, replace our only use of FIONBIO with O_NONBLOCK. Inspired by Jonathan H N Chin, who had problems with this on Solaris. git-svn-id: svn://svn.tartarus.org/sgt/putty@7753 cda61777-01e9-0310-a592-d414129be87e --- diff --git a/unix/uxpty.c b/unix/uxpty.c index 60dc7f7d..ca7e98ad 100644 --- a/unix/uxpty.c +++ b/unix/uxpty.c @@ -360,8 +360,10 @@ static void pty_open_master(Pty pty) /* * Set the pty master into non-blocking mode. */ - int i = 1; - ioctl(pty->master_fd, FIONBIO, &i); + int fl; + fl = fcntl(pty->master_fd, F_GETFL); + if (fl != -1 && !(fl & O_NONBLOCK)) + fcntl(pty->master_fd, F_SETFL, fl | O_NONBLOCK); } if (!ptys_by_fd)