From mboxrd@z Thu Jan 1 00:00:00 1970 Mailing-List: contact zsh-workers-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes Resent-Date: Sat, 30 Jan 1999 08:07:49 -0500 (EST) Message-Id: <9901301251.AA43826@ibmth.df.unipi.it> To: Drazen Kacar , zsh-workers@math.gatech.edu Subject: Re: PATCH: (more) Re: PATCH: 3.1.5* & 3.0.5: Re: strange xterm & zsh behaviour In-Reply-To: "Peter Stephenson"'s message of "Sat, 30 Jan 1999 13:43:54 NFT." <9901301244.AA63428@ibmth.df.unipi.it> Date: Sat, 30 Jan 1999 13:51:47 +0100 From: Peter Stephenson Resent-Message-ID: <"S74-W3.0.i.bGmis"@math> Resent-From: zsh-workers@math.gatech.edu X-Loop: zsh-workers@math.gatech.edu Resent-Sender: zsh-workers-request@math.gatech.edu X-Mailing-List: 5118 Peter Stephenson wrote: > You mean something like the following? I don't quite know how to test > for this, since you can't be assured fd 0 is /dev/tty. Maybe the > ioctl() on its own is enough. sorrysorry... this time I've tested it. (I didn't realise I could on AIX, but TIOCNXCL does exist after all.) This replaces the one two minutes ago. --- Src/init.c.tiocnxcl Sat Jan 30 13:29:37 1999 +++ Src/init.c Sat Jan 30 13:49:09 1999 @@ -300,6 +300,19 @@ /* Make sure the tty is opened read/write. */ if (isatty(0)) { +#ifdef TIOCNXCL + /* + * See if the terminal claims to be busy. If so, and fd 0 + * is a terminal, try and set non-exclusive use for that. + * This is something to do with Solaris over-cleverness. + */ + int tmpfd; + if ((tmpfd = open("/dev/tty", O_RDWR | O_NOCTTY)) < 0) { + if (errno == EBUSY) + ioctl(0, TIOCNXCL, 0); + } else + close(tmpfd); +#endif zsfree(ttystrname); if ((ttystrname = ztrdup(ttyname(0)))) SHTTY = movefd(open(ttystrname, O_RDWR | O_NOCTTY)); -- Peter Stephenson Tel: +39 050 844536 WWW: http://www.ifh.de/~pws/ Dipartimento di Fisica, Via Buonarroti 2, 56127 Pisa, Italy