Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/external/bsd/blacklist/bin Instead of deleting the rules ind...



details:   https://anonhg.NetBSD.org/src/rev/68921eecf56d
branches:  trunk
changeset: 839584:68921eecf56d
user:      christos <christos%NetBSD.org@localhost>
date:      Wed Feb 27 02:20:18 2019 +0000

description:
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).

diffstat:

 external/bsd/blacklist/bin/blacklistd.c |  13 ++++++++-----
 1 files changed, 8 insertions(+), 5 deletions(-)

diffs (49 lines):

diff -r 36be0d27c0b7 -r 68921eecf56d external/bsd/blacklist/bin/blacklistd.c
--- a/external/bsd/blacklist/bin/blacklistd.c   Tue Feb 26 21:55:28 2019 +0000
+++ b/external/bsd/blacklist/bin/blacklistd.c   Wed Feb 27 02:20:18 2019 +0000
@@ -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 @@
        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 @@
        conf_parse(configfile);
        if (flush) {
                rules_flush();
-               flags |= O_TRUNC;
+               if (!restore)
+                       flags |= O_TRUNC;
        }
 
        struct pollfd *pfd = NULL;
@@ -522,8 +522,11 @@
        if (state == NULL)
                return EXIT_FAILURE;
 
-       if (restore)
+       if (restore) {
+               if (!flush)
+                       rules_flush();
                rules_restore();
+       }
 
        if (!debug) {
                if (daemon(0, 0) == -1)



Home | Main Index | Thread Index | Old Index