X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fwrite_prometheus.c;h=572ba561995953adeff43f69d56308272bdc1fa3;hb=80294418289129eb75c9f07e2043adcbd02941a4;hp=ba186a7e73f1ea9b0d0f2d7eec1a99c1b7aedd70;hpb=ad0a12907bf80b4f0deec217b8379dd08c490dbc;p=collectd.git diff --git a/src/write_prometheus.c b/src/write_prometheus.c index ba186a7e..572ba561 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;