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
* 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:
* o Add commands for traffic summary, version display, etc.
@ -471,7 +471,7 @@ main(int argc, char **argv)
if_filename, strerror(errno));
VarTerm = 0; /* We know it's currently stdout */
close(0);
close(1);
close(2);
#ifdef DOTTYINIT
@ -482,7 +482,7 @@ main(int argc, char **argv)
TtyInit(1);
else {
setsid();
close(1);
close(0);
}
} else {
TtyInit(0);
@ -711,6 +711,7 @@ DoLoop()
if (OpenModem(mode) < 0)
return;
LogPrintf(LogPHASE, "Packet mode enabled\n");
close(0);
PacketMode();
} else if (mode & MODE_DEDICATED) {
if (modem < 0)

View File

@ -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.51 1997/09/10 02:20:30 brian Exp $
* $Id: modem.c,v 1.52 1997/09/16 23:15:14 brian Exp $
*
* TODO:
*/
@ -454,7 +454,7 @@ OpenModem(int mode)
} else {
/* must be a tcp connection */
LogPrintf(LogDEBUG, "OpenModem(direct): Modem is not a tty\n");
return modem = dup(1);
return modem = dup(0);
}
} else {
if (strncmp(VarDevice, "/dev/", 5) == 0) {