diff options
Diffstat (limited to 'usr.sbin/rtadvd')
-rw-r--r-- | usr.sbin/rtadvd/Makefile | 6 | ||||
-rw-r--r-- | usr.sbin/rtadvd/rtadvd.c | 17 |
2 files changed, 9 insertions, 14 deletions
diff --git a/usr.sbin/rtadvd/Makefile b/usr.sbin/rtadvd/Makefile index 6f14591aff9..1c43318ea5b 100644 --- a/usr.sbin/rtadvd/Makefile +++ b/usr.sbin/rtadvd/Makefile @@ -1,11 +1,11 @@ -# $OpenBSD: Makefile,v 1.2 2000/05/23 11:23:22 itojun Exp $ +# $OpenBSD: Makefile,v 1.3 2001/12/01 23:27:23 miod Exp $ PROG= rtadvd SRCS= rtadvd.c rrenum.c advcap.c if.c config.c timer.c dump.c CPPFLAGS+=-DINET6 -LDADD+= -lcompat -DPADD+= ${LIBCOMPAT} +LDADD+= -lcompat -lutil +DPADD+= ${LIBCOMPAT} ${LIBUTIL} MAN= rtadvd.8 rtadvd.conf.5 .include <bsd.prog.mk> diff --git a/usr.sbin/rtadvd/rtadvd.c b/usr.sbin/rtadvd/rtadvd.c index cd0d308b950..f0234f89de5 100644 --- a/usr.sbin/rtadvd/rtadvd.c +++ b/usr.sbin/rtadvd/rtadvd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rtadvd.c,v 1.11 2001/12/01 19:27:28 deraadt Exp $ */ +/* $OpenBSD: rtadvd.c,v 1.12 2001/12/01 23:27:23 miod Exp $ */ /* $KAME: rtadvd.c,v 1.50 2001/02/04 06:15:15 itojun Exp $ */ /* @@ -55,6 +55,8 @@ #include <string.h> #include <stdlib.h> #include <syslog.h> +#include <util.h> + #include "rtadvd.h" #include "rrenum.h" #include "advcap.h" @@ -77,7 +79,6 @@ struct sockaddr_in6 from; struct sockaddr_in6 sin6_allnodes = {sizeof(sin6_allnodes), AF_INET6}; struct in6_addr in6a_site_allrouters; static char *dumpfilename = "/var/run/rtadvd.dump"; /* XXX: should be configurable */ -static char *pidfilename = "/var/run/rtadvd.pid"; /* should be configurable */ static char *mcastif; int sock; int rtsock = -1; @@ -155,8 +156,6 @@ main(argc, argv) struct timeval *timeout; int i, ch; int fflag = 0; - FILE *pidfp; - pid_t pid; openlog("rtadvd", LOG_NDELAY|LOG_PID, LOG_DAEMON); @@ -241,14 +240,10 @@ main(argc, argv) daemon(1, 0); /* record the current PID */ - pid = getpid(); - if ((pidfp = fopen(pidfilename, "w")) == NULL) + if (pidfile(NULL) < 0) { syslog(LOG_ERR, - "<%s> failed to open a log file(%s), run anyway.", - __FUNCTION__, pidfilename); - else { - fprintf(pidfp, "%d\n", pid); - fclose(pidfp); + "<%s> failed to open the pid log file, run anyway.", + __FUNCTION__); } FD_ZERO(&fdset); |