Silence 'not available' log messages for nowarn run/task/service

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
Joachim Wiberg
2023-12-10 16:42:29 +01:00
parent cc979f27f1
commit cbf96a1de0
3 changed files with 6 additions and 5 deletions
+2 -2
View File
@@ -1620,7 +1620,7 @@ int service_register(int type, char *cfg, struct rlimit rlimit[], char *file)
strlcat(ident, id, sizeof(ident));
}
if (ifstmt && !svc_ifthen(1, ident, ifstmt))
if (ifstmt && !svc_ifthen(1, ident, ifstmt, nowarn))
return 0;
levels = conf_parse_runlevels(runlevels);
@@ -2027,7 +2027,7 @@ void service_mark_unavail(void)
if (!svc->ifstmt[0])
continue;
if (!svc_ifthen(1, svc_ident(svc, buf, sizeof(buf)), svc->ifstmt))
if (!svc_ifthen(1, svc_ident(svc, buf, sizeof(buf)), svc->ifstmt, svc->nowarn))
svc_mark(svc);
}
}
+3 -2
View File
@@ -649,7 +649,7 @@ int svc_enabled(svc_t *svc)
return 0;
}
if (!svc_ifthen(0, NULL, svc->ifstmt)) {
if (!svc_ifthen(0, NULL, svc->ifstmt, svc->nowarn)) {
// dbg("ifthen:%s>", svc->ifstmt[0] ? svc->ifstmt : "<");
return 0;
}
@@ -704,11 +704,12 @@ int svc_conflicts(svc_t *svc)
* @is_conf: Set when called by service_mark_unavail()
* @ident: svc_t identififcation (name:id)
* @stmt: if: statement from .conf file
* @quiet: If non-zero, do not warn in syslog
*
* Returns:
* %TRUE(1) yes, use this svc_t, %FALSE(0) prune
*/
int svc_ifthen(int is_conf, const char *ident, char *stmt)
int svc_ifthen(int is_conf, const char *ident, char *stmt, int quiet)
{
char stmts[MAX_IDENT_LEN];
int not = 0;
+1 -1
View File
@@ -249,7 +249,7 @@ void svc_prune_bootstrap (void);
void svc_enable (svc_t *svc);
int svc_enabled (svc_t *svc);
int svc_conflicts (svc_t *svc);
int svc_ifthen (int is_conf, const char *ident, char *stmt);
int svc_ifthen (int is_conf, const char *ident, char *stmt, int quiet);
int svc_parse_jobstr (char *str, size_t len, void *user_data, int (*found)(svc_t *, void *), int (not_found)(char *, char *, void *));