X-Git-Url: https://git.octo.it/?a=blobdiff_plain;ds=sidebyside;f=src%2Fwrite_prometheus.c;h=8554580f24e53141b4b27afc8327359a3eb4fb18;hb=2700666217249cd4794dfc17b4ac3b28f3dca56b;hp=28ab6ce7973e5947c006368c6a585f9408318f37;hpb=d1fd866038d0cfcd07cf7ecacf9f43a4997d36a9;p=collectd.git diff --git a/src/write_prometheus.c b/src/write_prometheus.c index 28ab6ce7..8554580f 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;