summaryrefslogtreecommitdiffstats
path: root/meta/recipes-support/rng-tools/rng-tools/0001-rngd-fix-debug-to-also-filter-syslog-calls.patch
blob: 07333786685d4576f569dd6be9dfc367288805e1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
From 213a869e8315ead2c739acfcbde712358a842dee Mon Sep 17 00:00:00 2001
From: Yann Dirson <yann@blade-group.com>
Date: Fri, 9 Oct 2020 15:12:26 +0200
Subject: [PATCH] rngd: fix --debug to also filter syslog() calls

Debug logs were only controlled by --debug flag while in --foreground
mode.  In --daemon mode /var/log/message got stuffed with details of
entropy pool refilling, which is useless in production, and hamful
when log rotation then gets rid of the more useful logs.  This is
especially true for embedded systems.

This change makes the two modes consistently only produce debug logs when
--debug is specified.

Upstream-Status: Backport [213a869e8315ead2c739acfcbde712358a842dee]

Signed-off-by: Yann Dirson <yann@blade-group.com>
---
 rngd.h | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/rngd.h b/rngd.h
index 901b6f1..a79ea0f 100644
--- a/rngd.h
+++ b/rngd.h
@@ -166,13 +166,13 @@ extern bool quiet;
 #define message(priority,fmt,args...) do { \
 	if (quiet) \
 		break;\
+	if (arguments->debug == false && LOG_PRI(priority) == LOG_DEBUG) \
+		break;\
 	if (am_daemon) { \
 		syslog((priority), fmt, ##args); \
 	} else if (!msg_squash) { \
-		if ((LOG_PRI(priority) != LOG_DEBUG) || (arguments->debug == true)) {\
-			fprintf(stderr, fmt, ##args); \
-			fflush(stderr); \
-		} \
+		fprintf(stderr, fmt, ##args); \
+		fflush(stderr); \
 	} \
 } while (0)
 
-- 
2.28.0