Andrew Geissler | f034379 | 2020-11-18 10:42:21 -0600 | [diff] [blame^] | 1 | From 213a869e8315ead2c739acfcbde712358a842dee Mon Sep 17 00:00:00 2001 |
| 2 | From: Yann Dirson <yann@blade-group.com> |
| 3 | Date: Fri, 9 Oct 2020 15:12:26 +0200 |
| 4 | Subject: [PATCH] rngd: fix --debug to also filter syslog() calls |
| 5 | |
| 6 | Debug logs were only controlled by --debug flag while in --foreground |
| 7 | mode. In --daemon mode /var/log/message got stuffed with details of |
| 8 | entropy pool refilling, which is useless in production, and hamful |
| 9 | when log rotation then gets rid of the more useful logs. This is |
| 10 | especially true for embedded systems. |
| 11 | |
| 12 | This change makes the two modes consistently only produce debug logs when |
| 13 | --debug is specified. |
| 14 | |
| 15 | Upstream-Status: Backport [213a869e8315ead2c739acfcbde712358a842dee] |
| 16 | |
| 17 | Signed-off-by: Yann Dirson <yann@blade-group.com> |
| 18 | --- |
| 19 | rngd.h | 8 ++++---- |
| 20 | 1 file changed, 4 insertions(+), 4 deletions(-) |
| 21 | |
| 22 | diff --git a/rngd.h b/rngd.h |
| 23 | index 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 | -- |
| 45 | 2.28.0 |
| 46 | |