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 more debugging from Kurt Lidl



details:   https://anonhg.NetBSD.org/src/rev/cab7d7720d0f
branches:  trunk
changeset: 351568:cab7d7720d0f
user:      christos <christos%NetBSD.org@localhost>
date:      Sat Feb 18 00:26:16 2017 +0000

description:
more debugging from Kurt Lidl

diffstat:

 external/bsd/blacklist/bin/blacklistd.c |  26 +++++++++++++++++++-------
 1 files changed, 19 insertions(+), 7 deletions(-)

diffs (75 lines):

diff -r bb6d1c51b19d -r cab7d7720d0f external/bsd/blacklist/bin/blacklistd.c
--- a/external/bsd/blacklist/bin/blacklistd.c   Fri Feb 17 22:31:08 2017 +0000
+++ b/external/bsd/blacklist/bin/blacklistd.c   Sat Feb 18 00:26:16 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: blacklistd.c,v 1.36 2017/01/09 03:05:48 christos Exp $ */
+/*     $NetBSD: blacklistd.c,v 1.37 2017/02/18 00:26:16 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.36 2017/01/09 03:05:48 christos Exp $");
+__RCSID("$NetBSD: blacklistd.c,v 1.37 2017/02/18 00:26:16 christos Exp $");
 
 #include <sys/types.h>
 #include <sys/socket.h>
@@ -207,7 +207,7 @@
 
        if (debug) {
                char b1[128], b2[128];
-               (*lfun)(LOG_DEBUG, "%s: db state info for %s: count=%d/%d "
+               (*lfun)(LOG_DEBUG, "%s: initial db state for %s: count=%d/%d "
                    "last=%s now=%s", __func__, rbuf, dbi.count, c.c_nfail,
                    fmttime(b1, sizeof(b1), dbi.last),
                    fmttime(b2, sizeof(b2), ts.tv_sec));
@@ -246,15 +246,24 @@
        case BL_DELETE:
                if (dbi.last == 0)
                        goto out;
+               dbi.count = 0;
                dbi.last = 0;
                break;
        default:
                (*lfun)(LOG_ERR, "unknown message %d", bi->bi_type); 
        }
-       if (state_put(state, &c, &dbi) == -1)
-               goto out;
+       state_put(state, &c, &dbi);
+
 out:
        close(bi->bi_fd);
+
+       if (debug) {
+               char b1[128], b2[128];
+               (*lfun)(LOG_DEBUG, "%s: final db state for %s: count=%d/%d "
+                   "last=%s now=%s", __func__, rbuf, dbi.count, c.c_nfail,
+                   fmttime(b1, sizeof(b1), dbi.last),
+                   fmttime(b2, sizeof(b2), ts.tv_sec));
+       }
 }
 
 static void
@@ -393,7 +402,7 @@
 int
 main(int argc, char *argv[])
 {
-       int c, tout, flags, flush, restore;
+       int c, tout, flags, flush, restore, ret;
        const char *spath, **blsock;
        size_t nblsock, maxblsock;
 
@@ -528,7 +537,10 @@
                        readconf = 0;
                        conf_parse(configfile);
                }
-               switch (poll(pfd, (nfds_t)nfd, tout)) {
+               ret = poll(pfd, (nfds_t)nfd, tout);
+               if (debug)
+                       (*lfun)(LOG_DEBUG, "received %d from poll()", ret);
+               switch (ret) {
                case -1:
                        if (errno == EINTR)
                                continue;



Home | Main Index | Thread Index | Old Index