diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2001-12-01 23:27:25 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2001-12-01 23:27:25 +0000 |
commit | b11bbb51235bd85172226ea037257b53ee9402da (patch) | |
tree | f6118a5419bc82550325ed0df2f3e50047f6ffbb /sbin | |
parent | ea7f37b365f29a8552fe175609d79d58051b87c4 (diff) |
Use pidfile() instead of doing the equivalent thing by hand, and sometimes
forgetting to unlink the pid file at exit.
ok millert@ deraadt@
Diffstat (limited to 'sbin')
-rw-r--r-- | sbin/pflogd/Makefile | 5 | ||||
-rw-r--r-- | sbin/pflogd/pflogd.c | 12 | ||||
-rw-r--r-- | sbin/rtsol/Makefile | 5 |
3 files changed, 10 insertions, 12 deletions
diff --git a/sbin/pflogd/Makefile b/sbin/pflogd/Makefile index 9ce0baf0f89..318de8f0fd7 100644 --- a/sbin/pflogd/Makefile +++ b/sbin/pflogd/Makefile @@ -1,7 +1,8 @@ -# $OpenBSD: Makefile,v 1.1 2001/08/21 22:29:14 deraadt Exp $ +# $OpenBSD: Makefile,v 1.2 2001/12/01 23:27:23 miod Exp $ CFLAGS+=-Wall -Werror -LDADD+= -lpcap +LDADD+= -lpcap -lutil +DPAPP+= ${LIBUTIL} PROG= pflogd SRCS= pflogd.c diff --git a/sbin/pflogd/pflogd.c b/sbin/pflogd/pflogd.c index 42b99bec812..66a7fc94d7a 100644 --- a/sbin/pflogd/pflogd.c +++ b/sbin/pflogd/pflogd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pflogd.c,v 1.8 2001/10/10 14:30:08 mpech Exp $ */ +/* $OpenBSD: pflogd.c,v 1.9 2001/12/01 23:27:23 miod Exp $ */ /* * Copyright (c) 2001 Theo de Raadt @@ -44,6 +44,7 @@ #include <errno.h> #include <stdarg.h> #include <fcntl.h> +#include <util.h> #define DEF_SNAPLEN 96 /* default plus allow for larger header of pflog */ #define PCAP_TO_MS 500 /* pcap read timeout (ms) */ @@ -51,7 +52,6 @@ #define PCAP_OPT_FIL 0 /* filter optimization */ #define FLUSH_DELAY 60 /* flush delay */ -#define PFLOGD_PID_FILE "/var/run/pflogd.pid" #define PFLOGD_LOG_FILE "/var/log/pflog" #define PFLOGD_DEFAULT_IF "pflog0" @@ -64,7 +64,6 @@ int gotsig_close, gotsig_alrm, gotsig_hup; char *filename = PFLOGD_LOG_FILE; char *interface = PFLOGD_DEFAULT_IF; -char *pidfile = PFLOGD_PID_FILE; char *filter = 0; char errbuf[PCAP_ERRBUF_SIZE]; @@ -275,7 +274,6 @@ main(int argc, char **argv) { struct pcap_stat pstat; int ch, np; - FILE *fp; while ((ch = getopt(argc, argv, "Dd:s:f:")) != -1) { switch (ch) { @@ -311,11 +309,7 @@ main(int argc, char **argv) logmsg(LOG_WARNING, "Failed to become deamon: %s", strerror(errno)); } - fp = fopen(pidfile, "w"); - if (fp != NULL) { - fprintf(fp, "%d\n", getpid()); - fclose(fp); - } + pidfile(NULL); } (void)umask(S_IRWXG | S_IRWXO); diff --git a/sbin/rtsol/Makefile b/sbin/rtsol/Makefile index a93a7b9ab58..427d0698795 100644 --- a/sbin/rtsol/Makefile +++ b/sbin/rtsol/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.3 2000/02/25 10:32:21 itojun Exp $ +# $OpenBSD: Makefile,v 1.4 2001/12/01 23:27:23 miod Exp $ PROG= rtsol SRCS= rtsold.c rtsol.c if.c probe.c dump.c @@ -8,6 +8,9 @@ CPPFLAGS+=-DINET6 -DHAVE_ARC4RANDOM -DHAVE_GETIFADDRS #MAN= rtsold.8 NOMAN= yes +LDADD+= -lutil +DPADD+= ${LIBUTIL} + .PATH: ${.CURDIR}/../../usr.sbin/rtsold .include <bsd.prog.mk> |