diff options
author | ache <ache@FreeBSD.org> | 1996-03-09 08:18:41 +0000 |
---|---|---|
committer | ache <ache@FreeBSD.org> | 1996-03-09 08:18:41 +0000 |
commit | f785271ddafea2eb75061d9de1d5b5bac3f48fb2 (patch) | |
tree | 47e0d9bc793b15289143d3acd7d90353b1d8cce8 | |
parent | eecb8eb3ab4d2ee26642bae8c0a4fef5a339b7d7 (diff) | |
download | FreeBSD-src-f785271ddafea2eb75061d9de1d5b5bac3f48fb2.zip FreeBSD-src-f785271ddafea2eb75061d9de1d5b5bac3f48fb2.tar.gz |
1) Open /dev/null for std* after setsid() to be shure that modem is
*not* our controlling terminal (SIGHUP can coming in other case)
2) Add HUPCL for non-dedicated lines to be shure that modem
properly resetted.
3) Correct usage string.
-rw-r--r-- | usr.sbin/ppp/main.c | 11 | ||||
-rw-r--r-- | usr.sbin/ppp/modem.c | 6 | ||||
-rw-r--r-- | usr.sbin/ppp/ppp.8 | 5 | ||||
-rw-r--r-- | usr.sbin/ppp/ppp.8.m4 | 5 |
4 files changed, 21 insertions, 6 deletions
diff --git a/usr.sbin/ppp/main.c b/usr.sbin/ppp/main.c index 87f9740..f80b6b2 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.14 1996/01/30 11:08:41 dfr Exp $ + * $Id: main.c,v 1.15 1996/03/08 09:03:05 ache Exp $ * * TODO: * o Add commands for traffic summary, version display, etc. @@ -396,7 +396,16 @@ char **argv; #endif TtyInit(); } else { + int fd; + setsid(); /* detach control tty */ + if ((fd = open(_PATH_DEVNULL, O_RDWR, 0)) != -1) { + (void)dup2(fd, STDIN_FILENO); + (void)dup2(fd, STDOUT_FILENO); + (void)dup2(fd, STDERR_FILENO); + if (fd > 2) + (void)close (fd); + } } } else { server = -1; diff --git a/usr.sbin/ppp/modem.c b/usr.sbin/ppp/modem.c index 444c12b..d69d732 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.13 1996/03/08 09:03:07 ache Exp $ + * $Id: modem.c,v 1.14 1996/03/08 12:34:40 ache Exp $ * * TODO: */ @@ -457,6 +457,8 @@ int mode; #else rstio.c_cflag = (CS8 | CREAD | CLOCAL); #endif + if (!(mode & MODE_DEDICATED)) + rstio.c_cflag |= HUPCL; if ((mode & MODE_DIRECT) == 0) { /* * If we are working as direct mode, don't change tty speed. @@ -532,6 +534,8 @@ int modem; modemios = rstio; rstio.c_cflag &= ~(CSIZE|PARENB|PARODD); rstio.c_cflag |= CS8; + if (!(mode & MODE_DEDICATED)) + rstio.c_cflag |= HUPCL; rstio.c_iflag &= ~(ISTRIP|IXON|IXOFF|BRKINT|ICRNL|INLCR); tcsetattr(modem, TCSADRAIN, &rstio); oldflag = fcntl(modem, F_GETFL, 0); diff --git a/usr.sbin/ppp/ppp.8 b/usr.sbin/ppp/ppp.8 index 78c30a6..425da21 100644 --- a/usr.sbin/ppp/ppp.8 +++ b/usr.sbin/ppp/ppp.8 @@ -1,5 +1,5 @@ .\" manual page [] for ppp 0.94 beta2 + alpha -.\" $Id: ppp.8,v 1.13 1996/01/30 13:50:10 mpp Exp $ +.\" $Id: ppp.8,v 1.14 1996/03/08 09:03:08 ache Exp $ .Dd 20 September 1995 .Os FreeBSD .Dt PPP 8 @@ -9,7 +9,8 @@ Point to Point Protocol (aka iijppp) .Sh SYNOPSIS .Nm -.Op Fl auto \*(Ba Fl direct Fl dedicated +.Op Fl auto | Fl direct | Fl dedicated +.Op Ar system .Sh DESCRIPTION This is a user process .Em PPP diff --git a/usr.sbin/ppp/ppp.8.m4 b/usr.sbin/ppp/ppp.8.m4 index 78c30a6..425da21 100644 --- a/usr.sbin/ppp/ppp.8.m4 +++ b/usr.sbin/ppp/ppp.8.m4 @@ -1,5 +1,5 @@ .\" manual page [] for ppp 0.94 beta2 + alpha -.\" $Id: ppp.8,v 1.13 1996/01/30 13:50:10 mpp Exp $ +.\" $Id: ppp.8,v 1.14 1996/03/08 09:03:08 ache Exp $ .Dd 20 September 1995 .Os FreeBSD .Dt PPP 8 @@ -9,7 +9,8 @@ Point to Point Protocol (aka iijppp) .Sh SYNOPSIS .Nm -.Op Fl auto \*(Ba Fl direct Fl dedicated +.Op Fl auto | Fl direct | Fl dedicated +.Op Ar system .Sh DESCRIPTION This is a user process .Em PPP |