aboutsummaryrefslogtreecommitdiffstats
path: root/bin/blacklistd.c
diff options
context:
space:
mode:
authorEd Maste <emaste@FreeBSD.org>2019-11-06 14:09:52 +0000
committerEd Maste <emaste@FreeBSD.org>2019-11-06 14:09:52 +0000
commit758bdc240105f5918fc17502042b47f00a314272 (patch)
tree98a60fee0afb7933bc75187532aeebc151a7096e /bin/blacklistd.c
parent52253412b1a4ba5050d6d44baaf6f40f3a5dd25f (diff)
downloadsrc-758bdc240105f5918fc17502042b47f00a314272.tar.gz
src-758bdc240105f5918fc17502042b47f00a314272.zip
Vendor import of NetBSD's external/bsd/blacklist @ 20191106vendor/NetBSD/blacklist/20191106vendor/NetBSD/blacklist
Sponsored by: The FreeBSD Foundation
Notes
Notes: svn path=/vendor/NetBSD/blacklist/dist/; revision=354388 svn path=/vendor/NetBSD/blacklist/20191106/; revision=354389; tag=vendor/NetBSD/blacklist/20191106
Diffstat (limited to 'bin/blacklistd.c')
-rw-r--r--bin/blacklistd.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/bin/blacklistd.c b/bin/blacklistd.c
index f5c35eae1ad2..ac92bbf2ffbf 100644
--- a/bin/blacklistd.c
+++ b/bin/blacklistd.c
@@ -1,4 +1,4 @@
-/* $NetBSD: blacklistd.c,v 1.37 2017/02/18 00:26:16 christos Exp $ */
+/* $NetBSD: blacklistd.c,v 1.38 2019/02/27 02:20:18 christos Exp $ */
/*-
* Copyright (c) 2015 The NetBSD Foundation, Inc.
@@ -32,7 +32,7 @@
#include "config.h"
#endif
#include <sys/cdefs.h>
-__RCSID("$NetBSD: blacklistd.c,v 1.37 2017/02/18 00:26:16 christos Exp $");
+__RCSID("$NetBSD: blacklistd.c,v 1.38 2019/02/27 02:20:18 christos Exp $");
#include <sys/types.h>
#include <sys/socket.h>
@@ -394,7 +394,6 @@ rules_restore(void)
for (f = 1; state_iterate(state, &c, &dbi, f) == 1; f = 0) {
if (dbi.id[0] == '\0')
continue;
- (void)run_change("rem", &c, dbi.id, 0);
(void)run_change("add", &c, dbi.id, sizeof(dbi.id));
}
}
@@ -491,7 +490,8 @@ main(int argc, char *argv[])
conf_parse(configfile);
if (flush) {
rules_flush();
- flags |= O_TRUNC;
+ if (!restore)
+ flags |= O_TRUNC;
}
struct pollfd *pfd = NULL;
@@ -522,8 +522,11 @@ main(int argc, char *argv[])
if (state == NULL)
return EXIT_FAILURE;
- if (restore)
+ if (restore) {
+ if (!flush)
+ rules_flush();
rules_restore();
+ }
if (!debug) {
if (daemon(0, 0) == -1)