diff options
author | brian <brian@FreeBSD.org> | 1997-09-18 00:15:25 +0000 |
---|---|---|
committer | brian <brian@FreeBSD.org> | 1997-09-18 00:15:25 +0000 |
commit | 109ba0ca66db09790df1c93e4ee1ba2239344d64 (patch) | |
tree | a0ec2e562371373382e6209313c3346ffb0d802e /usr.sbin | |
parent | af684d25950567ee4267a2074d25148ffd8b29fc (diff) | |
download | FreeBSD-src-109ba0ca66db09790df1c93e4ee1ba2239344d64.zip FreeBSD-src-109ba0ca66db09790df1c93e4ee1ba2239344d64.tar.gz |
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>
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/ppp/main.c | 7 | ||||
-rw-r--r-- | usr.sbin/ppp/modem.c | 4 |
2 files changed, 6 insertions, 5 deletions
diff --git a/usr.sbin/ppp/main.c b/usr.sbin/ppp/main.c index 2faedcf..bc71573 100644 --- a/usr.sbin/ppp/main.c +++ b/usr.sbin/ppp/main.c @@ -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) diff --git a/usr.sbin/ppp/modem.c b/usr.sbin/ppp/modem.c index 61248ae..35f52b2 100644 --- a/usr.sbin/ppp/modem.c +++ b/usr.sbin/ppp/modem.c @@ -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) { |