From: Mikhail Gusarov Date: Fri, 28 Mar 2014 16:28:16 +0000 (+0100) Subject: LISTEN_FDS specifies number of passed sockets, not the first available fd X-Git-Tag: 0.7.0~346^2~4 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=1e1a8b00975dcf278c7987e3905c9147e23a1d02;p=rspamd.git LISTEN_FDS specifies number of passed sockets, not the first available fd --- diff --git a/src/main.c b/src/main.c index ba091a7f0..364e20950 100644 --- a/src/main.c +++ b/src/main.c @@ -564,7 +564,7 @@ systemd_get_socket (gint number, gint listen_type) if (e != NULL) { errno = 0; max = strtoul (e, &err, 10); - if ((e == NULL || *e == '\0') && max > number + sd_listen_fds_start) { + if ((e == NULL || *e == '\0') && max > number) { sock = number + sd_listen_fds_start; if (fstat (sock, &st) == -1) { return NULL; @@ -584,7 +584,7 @@ systemd_get_socket (gint number, gint listen_type) } result = g_list_prepend (result, GINT_TO_POINTER (sock)); } - else if (max <= number + sd_listen_fds_start) { + else if (max <= number) { errno = EOVERFLOW; } }