X-Git-Url: http://git.ozlabs.org/?p=ppp.git;a=blobdiff_plain;f=pppd%2Fsys-osf.c;h=a291a27d099cb78016b8fb6c727abf98be77906b;hp=45e176f788caabc4fbf8ea8aef7cd376e8eac227;hb=875d9641d05b4fcb7e186f784c801962bb2670e5;hpb=093489a1ce40a2075b1c5c9feb03c7ab1659d884 diff --git a/pppd/sys-osf.c b/pppd/sys-osf.c index 45e176f..a291a27 100644 --- a/pppd/sys-osf.c +++ b/pppd/sys-osf.c @@ -26,7 +26,7 @@ */ #ifndef lint -static char rcsid[] = "$Id: sys-osf.c,v 1.24 1999/04/01 07:20:10 paulus Exp $"; +static const char rcsid[] = "$Id: sys-osf.c,v 1.29 1999/08/12 04:25:24 paulus Exp $"; #endif #include @@ -200,7 +200,7 @@ sys_check_options() return 1; } - +#if 0 /* * daemon - Detach us from controlling terminal session. */ @@ -224,6 +224,7 @@ daemon(nochdir, noclose) } return 0; } +#endif /* * ppp_available - check whether the system has any ppp interfaces @@ -374,6 +375,13 @@ establish_ppp(fd) if (i != fd && i != sockfd) close(i); closed_stdio = 1; + /* make sure 0, 1, 2 are open to /dev/null */ + while ((i = open("/dev/null", O_RDWR)) >= 0) { + if (i > 2) { + close(i); + break; + } + } } /* @@ -836,7 +844,7 @@ read_packet(buf) flags = 0; len = getmsg(pppfd, &ctrl, &data, &flags); if (len < 0) { - if (errno = EAGAIN || errno == EWOULDBLOCK || errno == EINTR) + if (errno == EAGAIN || errno == EWOULDBLOCK || errno == EINTR) return -1; fatal("Error reading packet: %m"); } @@ -1112,6 +1120,7 @@ sifdown(u) { struct ifreq ifr; + bzero(&ifr, sizeof(ifr)); strlcpy(ifr.ifr_name, ifname, sizeof(ifr.ifr_name)); if (ioctl(sockfd, SIOCGIFFLAGS, &ifr) < 0) { error("Couldn't mark interface down (get): %m"); @@ -1204,7 +1213,8 @@ sifaddr(u, o, h, m) ret = 0; } - ifr.ifr_metric = link_mtu; + ifr.ifr_data = (caddr_t)&link_mtu; + if (ioctl(sockfd, SIOCSIPMTU, &ifr) < 0) { error("Couldn't set IP MTU: %m"); ret = 0; @@ -1434,9 +1444,9 @@ logwtmp(line, name, host) if ((fd = open(WTMPFILE, O_WRONLY|O_APPEND, 0)) < 0) return; if (!fstat(fd, &buf)) { - strlcpy(ut.ut_line, line, sizeof(ut.ut_line)); - strlcpy(ut.ut_name, name, sizeof(ut.ut_name)); - strlcpy(ut.ut_host, host, sizeof(ut.ut_host)); + strncpy(ut.ut_line, line, sizeof(ut.ut_line)); + strncpy(ut.ut_name, name, sizeof(ut.ut_name)); + strncpy(ut.ut_host, host, sizeof(ut.ut_host)); (void)time(&ut.ut_time); if (write(fd, (char *)&ut, sizeof(struct utmp)) != sizeof(struct utmp)) (void)ftruncate(fd, buf.st_size); @@ -1658,6 +1668,7 @@ get_pty(master_fdp, slave_fdp, slave_name, uid) return 1; } +#if 0 /* * Code for locking/unlocking the serial device. * This code is derived from chat.c. @@ -1761,6 +1772,7 @@ unlock() lock_file = NULL; } } +#endif int set_filters(pass, active)