X-Git-Url: https://git.octo.it/?p=collectd.git;a=blobdiff_plain;f=src%2Fwrite_prometheus.c;h=3b32ac092e77915657ad91f1081bae43a0feedb8;hp=53a07095201b2fda18245052030d914541bb1751;hb=711f5b6c86f51061c21bedcaa46214a01de0125c;hpb=e19d1f0affb0b68e11c9ed3448b3d5a663bb0049 diff --git a/src/write_prometheus.c b/src/write_prometheus.c index 53a07095..3b32ac09 100644 --- a/src/write_prometheus.c +++ b/src/write_prometheus.c @@ -760,7 +760,12 @@ static int prom_open_socket(int addrfamily) { int fd = -1; for (struct addrinfo *ai = res; ai != NULL; ai = ai->ai_next) { - fd = socket(ai->ai_family, ai->ai_socktype | SOCK_CLOEXEC, 0); + int flags = ai->ai_socktype; +#ifdef SOCK_CLOEXEC + flags |= SOCK_CLOEXEC; +#endif + + fd = socket(ai->ai_family, flags, 0); if (fd == -1) continue;