mirror of
https://git.FreeBSD.org/src.git
synced 2025-01-30 16:51:41 +00:00
It turns out that the following:
close(1); close(2); x = open(ctermid(NULL), O_RDWR|O_NONBLOCK); close(0) on a tty causes select() to return an exception for descriptor x ! This is the case in RELENG_2_2, but not in 2.2.2. I'm not sure why. Instead of doing the x=open() and close(0), we just do x=0 now. Problem pointed out by: Greg Lehey <grog@lemis.com> Tomi Vainio <tomppa@fidata.fi>
This commit is contained in:
parent
9bfd2669e9
commit
c47cab6191
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=29668
@ -17,7 +17,7 @@
|
||||
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* $Id: main.c,v 1.78 1997/09/16 23:15:13 brian Exp $
|
||||
* $Id: main.c,v 1.79 1997/09/18 00:15:25 brian Exp $
|
||||
*
|
||||
* TODO:
|
||||
* o Add commands for traffic summary, version display, etc.
|
||||
@ -711,7 +711,6 @@ DoLoop()
|
||||
if (OpenModem(mode) < 0)
|
||||
return;
|
||||
LogPrintf(LogPHASE, "Packet mode enabled\n");
|
||||
close(0);
|
||||
PacketMode();
|
||||
} else if (mode & MODE_DEDICATED) {
|
||||
if (modem < 0)
|
||||
|
@ -17,7 +17,7 @@
|
||||
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* $Id: modem.c,v 1.52 1997/09/16 23:15:14 brian Exp $
|
||||
* $Id: modem.c,v 1.53 1997/09/18 00:15:25 brian Exp $
|
||||
*
|
||||
* TODO:
|
||||
*/
|
||||
@ -442,20 +442,9 @@ OpenModem(int mode)
|
||||
LogPrintf(LogDEBUG, "OpenModem: Modem is already open!\n");
|
||||
/* We're going back into "term" mode */
|
||||
else if (mode & MODE_DIRECT) {
|
||||
if (isatty(0)) {
|
||||
char *dev;
|
||||
modem = open(dev = ctermid(NULL), O_RDWR | O_NONBLOCK);
|
||||
if (modem < 0) {
|
||||
LogPrintf(LogERROR, "OpenModem(direct) failed: %s: %s\n",
|
||||
dev, strerror(errno));
|
||||
return (-1);
|
||||
}
|
||||
LogPrintf(LogDEBUG, "OpenModem(direct): Modem is a tty\n");
|
||||
} else {
|
||||
/* must be a tcp connection */
|
||||
LogPrintf(LogDEBUG, "OpenModem(direct): Modem is not a tty\n");
|
||||
return modem = dup(0);
|
||||
}
|
||||
LogPrintf(LogDEBUG, "OpenModem(direct): Modem is %sa tty\n",
|
||||
isatty(0) ? "" : "not ");
|
||||
return modem = 0;
|
||||
} else {
|
||||
if (strncmp(VarDevice, "/dev/", 5) == 0) {
|
||||
if ((res = uu_lock(VarBaseDevice)) != UU_LOCK_OK) {
|
||||
|
Loading…
Reference in New Issue
Block a user