projects
/
collectd.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
(from parent 1:
e66bc65
)
Merge pull request #3059 from octo/sock_cloexec
author
Florian Forster
<ff@octo.it>
Wed, 6 Feb 2019 22:16:01 +0000
(23:16 +0100)
committer
GitHub
<noreply@github.com>
Wed, 6 Feb 2019 22:16:01 +0000
(23:16 +0100)
write_prometheus plugin: Only use SOCK_CLOEXEC if it is defined.
src/write_prometheus.c
patch
|
blob
|
history
diff --git
a/src/write_prometheus.c
b/src/write_prometheus.c
index
ba186a7
..
572ba56
100644
(file)
--- 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;