From d3454d963917dbe67d7698d3b9ee263c6ff2866f Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Wed, 11 Mar 2015 16:01:27 +0000 Subject: [PATCH] Improve systemd support diagnostic. --- src/libserver/cfg_utils.c | 2 ++ src/main.c | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/src/libserver/cfg_utils.c b/src/libserver/cfg_utils.c index e28f6445e..28dadd4ae 100644 --- a/src/libserver/cfg_utils.c +++ b/src/libserver/cfg_utils.c @@ -113,7 +113,9 @@ rspamd_parse_bind_line (struct rspamd_config *cfg, cnf->is_systemd = TRUE; cnf->cnt = strtoul (tokens[1], &err, 10); cnf->addrs = NULL; + if (err == NULL || *err == '\0') { + cnf->name = rspamd_mempool_strdup (cfg->cfg_pool, str); LL_PREPEND (cf->bind_conf, cnf); } else { diff --git a/src/main.c b/src/main.c index a99c0a48b..b6a133fe6 100644 --- a/src/main.c +++ b/src/main.c @@ -610,9 +610,11 @@ systemd_get_socket (gint number) if ((err == NULL || *err == '\0') && num_passed > number) { sock = number + sd_listen_fds_start; if (fstat (sock, &st) == -1) { + msg_warn ("cannot stat systemd descriptor %d", sock); return NULL; } if (!S_ISSOCK (st.st_mode)) { + msg_warn ("systemd descriptor %d is not a socket", sock); errno = EINVAL; return NULL; } @@ -623,10 +625,13 @@ systemd_get_socket (gint number) result = g_list_prepend (result, GINT_TO_POINTER (sock)); } else if (num_passed <= number) { + msg_warn ("systemd LISTEN_FDS does not contain the expected fd: %d", + num_passed); errno = EOVERFLOW; } } else { + msg_warn ("cannot get systemd variable 'LISTEN_FDS'"); errno = ENOENT; } -- 2.39.5