Module Name: src
Committed By: christos
Date: Wed Feb 27 02:20:19 UTC 2019
Modified Files:
src/external/bsd/blacklist/bin: blacklistd.c
Log Message:
Instead of deleting the rules individually use flush to kill them all at
once for efficiently. Also when restoring, don't nuke the database
(Phil Rulon).
To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 src/external/bsd/blacklist/bin/blacklistd.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/external/bsd/blacklist/bin/blacklistd.c
diff -u src/external/bsd/blacklist/bin/blacklistd.c:1.37 src/external/bsd/blacklist/bin/blacklistd.c:1.38
--- src/external/bsd/blacklist/bin/blacklistd.c:1.37 Fri Feb 17 19:26:16 2017
+++ src/external/bsd/blacklist/bin/blacklistd.c Tue Feb 26 21:20:18 2019
@@ -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)