blob: 07333786685d4576f569dd6be9dfc367288805e1 [file] [log] [blame]
Andrew Geissleraf5e4ef2020-10-16 10:22:50 -05001From 213a869e8315ead2c739acfcbde712358a842dee Mon Sep 17 00:00:00 2001
2From: Yann Dirson <yann@blade-group.com>
3Date: Fri, 9 Oct 2020 15:12:26 +0200
4Subject: [PATCH] rngd: fix --debug to also filter syslog() calls
5
6Debug logs were only controlled by --debug flag while in --foreground
7mode. In --daemon mode /var/log/message got stuffed with details of
8entropy pool refilling, which is useless in production, and hamful
9when log rotation then gets rid of the more useful logs. This is
10especially true for embedded systems.
11
12This change makes the two modes consistently only produce debug logs when
13--debug is specified.
14
15Upstream-Status: Backport [213a869e8315ead2c739acfcbde712358a842dee]
16
17Signed-off-by: Yann Dirson <yann@blade-group.com>
18---
19 rngd.h | 8 ++++----
20 1 file changed, 4 insertions(+), 4 deletions(-)
21
22diff --git a/rngd.h b/rngd.h
23index 901b6f1..a79ea0f 100644
24--- a/rngd.h
25+++ b/rngd.h
26@@ -166,13 +166,13 @@ extern bool quiet;
27 #define message(priority,fmt,args...) do { \
28 if (quiet) \
29 break;\
30+ if (arguments->debug == false && LOG_PRI(priority) == LOG_DEBUG) \
31+ break;\
32 if (am_daemon) { \
33 syslog((priority), fmt, ##args); \
34 } else if (!msg_squash) { \
35- if ((LOG_PRI(priority) != LOG_DEBUG) || (arguments->debug == true)) {\
36- fprintf(stderr, fmt, ##args); \
37- fflush(stderr); \
38- } \
39+ fprintf(stderr, fmt, ##args); \
40+ fflush(stderr); \
41 } \
42 } while (0)
43
44--
452.28.0
46