]> git.ipfire.org Git - thirdparty/knot-resolver.git/commitdiff
gc: fix flushing of messages to logs
authorVladimír Čunát <vladimir.cunat@nic.cz>
Tue, 9 Jun 2020 04:24:42 +0000 (06:24 +0200)
committerTomas Krizek <tomas.krizek@nic.cz>
Mon, 29 Jun 2020 12:25:26 +0000 (14:25 +0200)
There were the usual effects: very incorrect timestamps (even by days),
and I suspect we could even lose some logs completely.

NEWS
utils/cache_gc/main.c

diff --git a/NEWS b/NEWS
index 5d50772f7e8d5618913e394611cd1f9ab634d0b9..fe2ebe2a8669b08f567c6369381b427785685143 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -6,6 +6,7 @@ Bugfixes
 - hints module: NODATA answers also for non-address queries (!1005)
 - tls: send alert to peer if handshake fails (!1007)
 - cache: fix interaction between LMDB locks and preallocation (!1013)
+- cache garbage collector: fix flushing of messages to logs (!1009)
 
 
 Knot Resolver 5.1.1 (2020-05-19)
index 6738ba03d2b015b4bd32e61e1381eb7797acb929..cd868553fcf393d914a7ebb091ed0da987a55cb2 100644 (file)
@@ -56,6 +56,11 @@ static long get_nonneg_optarg()
 int main(int argc, char *argv[])
 {
        printf("Knot Resolver Cache Garbage Collector v. %s\n", KR_CACHE_GC_VERSION);
+       if (setvbuf(stdout, NULL, _IONBF, 0) || setvbuf(stderr, NULL, _IONBF, 0)) {
+               fprintf(stderr, "Failed to to set output buffering (ignored): %s\n",
+                               strerror(errno));
+               fflush(stderr);
+       }
 
        signal(SIGTERM, got_killed);
        signal(SIGKILL, got_killed);