Skip to content

Commit 2cba6f7

Browse files
committed
syslog: suppress message not belonging to log
Some messages sent to the notifier are not for logging, but they are for the progress interface or they must reach a process. Currently, such as messages are not recognized and a FATAL_UNKNOWN mesagge is sent to the syslog server. This simply ignores messages that do not need to be looged. Signed-off-by: Stefano Babic <[email protected]> Reported-by: Christian Storm <[email protected]>
1 parent 3cbdb19 commit 2cba6f7

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

core/syslog.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@ void syslog_notifier(RECOVERY_STATUS status, int error, int level, const char *m
2020
{
2121
const char* statusMsg;
2222

23-
openlog("swupdate", 0, LOG_USER);
24-
2523
switch(status) {
2624
case IDLE: statusMsg = "IDLE"; break;
2725
case DOWNLOAD: statusMsg = "DOWNLOAD"; break;
@@ -30,9 +28,15 @@ void syslog_notifier(RECOVERY_STATUS status, int error, int level, const char *m
3028
case SUCCESS: statusMsg = "SUCCESS"; break;
3129
case FAILURE: statusMsg = "FAILURE"; break;
3230
case DONE: statusMsg = "DONE"; break;
33-
default: statusMsg = "UNKNOWN"; break;
31+
/*
32+
* Unknown messages are maybe for other subsystems
33+
* and not to the logger, so silently ignore them
34+
*/
35+
default: return;
3436
}
3537

38+
openlog("swupdate", 0, LOG_USER);
39+
3640
int logprio = LOG_INFO;
3741
switch (level) {
3842
case ERRORLEVEL: logprio = LOG_ERR; break;

0 commit comments

Comments
 (0)