Fixed: [Backend hangs when doing "process services restart" in the CLI](https://github.com/clicon/clixon-controller/issues/178)

This commit is contained in:
Olof hagsand 2025-01-17 13:53:44 +01:00
parent b7d91607b6
commit 271569b194
2 changed files with 9 additions and 2 deletions

View file

@ -340,8 +340,14 @@ clixon_log_str(int level,
/* Remove trailing CR if any */
if (strlen(msg) && msg[strlen(msg)-1] == '\n')
msg[strlen(msg)-1] = '\0';
if (_log_flags & CLIXON_LOG_SYSLOG)
syslog(LOG_MAKEPRI(LOG_USER, level), "%s", msg); // XXX this may block
if (_log_flags & CLIXON_LOG_SYSLOG){
static int _recurse = 0;
/* avoid mutex if called recursively */
if (_recurse++ == 0){
syslog(LOG_MAKEPRI(LOG_USER, level), "%s", msg);
_recurse = 0;
}
}
/* syslog makes own filtering, we do it here:
* if normal (not debug) then filter loglevels >= debug
*/