Don't close(1) in direct mode and then proceed to

isatty(1) !  Keep 0 open for this till the modem's
been set up by either dup()ing 0 or by opening
ctermid(NULL) (if isatty(0)).

Discussed problem with: Tomi Vainio <tomppa@fidata.fi>
Made it finally dawn on me: Angelo Turetta <ATuretta@stylo.it>
This commit is contained in:
brian 1997-09-18 00:15:25 +00:00
parent af684d2595
commit 109ba0ca66
2 changed files with 6 additions and 5 deletions

View File

@ -17,7 +17,7 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
* *
* $Id: main.c,v 1.77 1997/09/04 00:38:19 brian Exp $ * $Id: main.c,v 1.78 1997/09/16 23:15:13 brian Exp $
* *
* TODO: * TODO:
* o Add commands for traffic summary, version display, etc. * o Add commands for traffic summary, version display, etc.
@ -471,7 +471,7 @@ main(int argc, char **argv)
if_filename, strerror(errno)); if_filename, strerror(errno));
VarTerm = 0; /* We know it's currently stdout */ VarTerm = 0; /* We know it's currently stdout */
close(0); close(1);
close(2); close(2);
#ifdef DOTTYINIT #ifdef DOTTYINIT
@ -482,7 +482,7 @@ main(int argc, char **argv)
TtyInit(1); TtyInit(1);
else { else {
setsid(); setsid();
close(1); close(0);
} }
} else { } else {
TtyInit(0); TtyInit(0);
@ -711,6 +711,7 @@ DoLoop()
if (OpenModem(mode) < 0) if (OpenModem(mode) < 0)
return; return;
LogPrintf(LogPHASE, "Packet mode enabled\n"); LogPrintf(LogPHASE, "Packet mode enabled\n");
close(0);
PacketMode(); PacketMode();
} else if (mode & MODE_DEDICATED) { } else if (mode & MODE_DEDICATED) {
if (modem < 0) if (modem < 0)

View File

@ -17,7 +17,7 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
* *
* $Id: modem.c,v 1.51 1997/09/10 02:20:30 brian Exp $ * $Id: modem.c,v 1.52 1997/09/16 23:15:14 brian Exp $
* *
* TODO: * TODO:
*/ */
@ -454,7 +454,7 @@ OpenModem(int mode)
} else { } else {
/* must be a tcp connection */ /* must be a tcp connection */
LogPrintf(LogDEBUG, "OpenModem(direct): Modem is not a tty\n"); LogPrintf(LogDEBUG, "OpenModem(direct): Modem is not a tty\n");
return modem = dup(1); return modem = dup(0);
} }
} else { } else {
if (strncmp(VarDevice, "/dev/", 5) == 0) { if (strncmp(VarDevice, "/dev/", 5) == 0) {