From owner-taylor-uucp@gnu.ai.mit.edu Mon Apr 20 04:36:00 1992
Status: RO
X-VM-v5-Data: ([nil nil nil nil nil nil nil nil nil]
	[nil nil nil nil nil nil nil nil nil nil nil nil "^From:" nil nil nil])
Received: from fuug.fi by dolphin.funet.fi with SMTP id AA02909
  (5.65c/IDA-1.4.3 for ojala); Mon, 20 Apr 1992 04:35:57 +0300
Received: from wookumz.gnu.ai.mit.edu by fuug.fi with SMTP id AA18280
  (5.65c/IDA-1.4.4 for <taylor-uucp-list@fuug.fi>); Mon, 20 Apr 1992 04:33:12 +0300
Received: by wookumz.gnu.ai.mit.edu (5.65/4.0)
	id <AA14596@wookumz.gnu.ai.mit.edu>; Sun, 19 Apr 92 21:04:17 -0400
Received: from relay1.UU.NET by wookumz.gnu.ai.mit.edu (5.65/4.0) with SMTP
	id <AA14592@wookumz.gnu.ai.mit.edu>; Sun, 19 Apr 92 21:04:12 -0400
Received: from uunet.uu.net (via LOCALHOST.UU.NET) by relay1.UU.NET with SMTP 
	(5.61/UUNET-internet-primary) id AA17737; Sun, 19 Apr 92 21:04:09 -0400
Received: from airs.UUCP by uunet.uu.net with UUCP/RMAIL
	(queueing-rmail) id 210341.17420; Sun, 19 Apr 1992 21:03:41 EDT
Received: by comton.airs.com (5.57/AIRS1.0)
	id AA12414; Sun, 19 Apr 92 20:37:36 -0400
Message-Id: <9204200037.AA12414@comton.airs.com>
X-Mailer: ELM [version 2.3 PL11]
From: ian@airs.com (Ian Lance Taylor)
To: taylor-uucp@gnu.ai.mit.edu
Subject: Temporary patch for NeXT port locking problems
Date: Sun, 19 Apr 92 20:37:34 -0400

Andrew Loewenstern reports that the following patch appears to fix the
port locking problem on the NeXT.  I'd like to thank him for testing
several different patches that I've sent him.  This patch isn't
perfect, as it is possible that if you call several different people
on multiple modems the code won't switch between controlling terminals
correctly.  So I don't recommend applying it unless you have a NeXT,
or some other computer that has this problem (I have had one report
that the Sun can suffer from it, and it is possible that this bug
could occur on any system which uses the interlocked /dev/tty and
/dev/cua system for sharing a serial port).  I'm sending it out as is
because a fully correct patch will take more time than I have at the
moment, and probably most people only have one modem anyhow in which
case this will do no harm.

*** code/uucp/sys1.unx	Wed Apr 15 16:11:35 1992
--- sys1.unx	Sat Apr 18 11:03:37 1992
***************
*** 734,739 ****
--- 734,745 ----
  
  #endif /* ! HAVE_BSD_PGRP || ! HAVE_TIOCNOTTY */
  
+ #if HAVE_TIOCNOTTY
+   /* Lose our controlling terminal.  */
+ 
+   (void) ioctl (0, TIOCNOTTY, (char *) NULL);
+ #endif /* HAVE_TIOCNOTTY */
+ 
    /* Close all open files.  */
  
    ulog_close ();
***************
*** 749,769 ****
      ulog (LOG_FATAL, "open (/dev/null): %s", strerror (errno));
  
  #if HAVE_BSD_PGRP
- 
- #if HAVE_TIOCNOTTY
-   /* Lose our controlling terminal.  */
- 
- #ifndef O_NDELAY
- #define O_NDELAY FNDELAY
- #endif
- 
-   o = open ("/dev/tty", O_RDWR | O_NDELAY, 0);
-   if (o >= 0)
-     {
-       (void) ioctl (o, TIOCNOTTY, (char *) NULL);
-       (void) close (o);
-     }
- #endif /* HAVE_TIOCNOTTY */
  
    /* Make sure our process group ID is set to 0.  On BSD TIOCNOTTY
       should already have set it 0, so this will do no harm.  On System
--- 755,760 ----

-- 
Ian Taylor                     ian@airs.com                    uunet!airs!ian
First person to identify this quote wins a free e-mail message:
``Do you make a grievance of weighing so many pounds only, instead of three
  hundred?  Then why fret about living so many years only, instead of more?''

