diff options
Diffstat (limited to 'usr.sbin/ppp/modem.c')
-rw-r--r-- | usr.sbin/ppp/modem.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/usr.sbin/ppp/modem.c b/usr.sbin/ppp/modem.c index d5dc70f..b34545e 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.41 1997/05/29 02:29:13 brian Exp $ + * $Id: modem.c,v 1.42 1997/06/09 03:27:30 brian Exp $ * * TODO: */ @@ -359,6 +359,7 @@ char *host, *port; LogPrintf(LogWARN, "OpenConnection: connection failed.\n"); return(-1); } + LogPrintf(LogDEBUG, "OpenConnection: modem fd is %d.\n", sock); return(sock); } @@ -381,8 +382,9 @@ int mode; LogPrintf(LogPHASE, "Open Failed %s\n", ctermid(NULL)); return(modem); } - } else if (modem < 0) - return(modem); + } else + /* must be a tcp connection */ + return modem = dup(1); } else if (modem < 0) { if (strncmp(VarDevice, "/dev/", 5) == 0) { if ((res = uu_lock(VarBaseDevice)) != UU_LOCK_OK) { @@ -680,7 +682,6 @@ int fd; if (modemout) { nb = modemout->cnt; if (nb > 1600) nb = 1600; - if (fd == 0) fd = 1; /* XXX WTFO! This is bogus */ nw = write(fd, MBUF_CTOP(modemout), nb); LogPrintf(LogDEBUG, "ModemStartOutput: wrote: %d(%d)\n", nw, nb); LogDumpBuff(LogDEBUG, "ModemStartOutput: modem write", @@ -693,8 +694,11 @@ int fd; LogPrintf(LogDEBUG, "ModemStartOutput: mbfree\n"); } } else if (nw < 0) { - if (errno != EAGAIN) - LogPrintf(LogERROR, "modem write: %s", strerror(errno)); + if (errno != EAGAIN) { + LogPrintf(LogERROR, "modem write (%d): %s", modem, strerror(errno)); + reconnect(RECON_TRUE); + DownConnection(); + } } } } |