summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Härdeman <david@hardeman.nu>2020-06-10 23:18:03 +0200
committerDavid Härdeman <david@hardeman.nu>2020-06-10 23:18:03 +0200
commit6adb89c30c9e876848fa84774674db0fd05dad8d (patch)
treea021d898bb72be98ab65869112b08b2172ad7e6b
parent1a3611151af25d4cf74ce1042cfe8b16fc85f3cb (diff)
Make all sockets close-on-exec
-rw-r--r--announce.c2
-rw-r--r--ctest.c2
-rw-r--r--idle.c2
-rw-r--r--proxy.c2
-rw-r--r--rcon.c2
-rw-r--r--server.c2
-rw-r--r--stest.c2
7 files changed, 7 insertions, 7 deletions
diff --git a/announce.c b/announce.c
index 3a50771..cc5d549 100644
--- a/announce.c
+++ b/announce.c
@@ -173,7 +173,7 @@ announce_init(struct cfg *cfg)
if (afd < 0)
perrordie("timerfd_create");
- sfd = socket(AF_INET, SOCK_DGRAM, 0);
+ sfd = socket(AF_INET, SOCK_DGRAM | SOCK_CLOEXEC, 0);
if (sfd < 0)
perrordie("socket");
diff --git a/ctest.c b/ctest.c
index 2e871cb..b0a367d 100644
--- a/ctest.c
+++ b/ctest.c
@@ -27,7 +27,7 @@ main(int argc, char **argv) {
exit(EXIT_FAILURE);
}
- sfd = socket(AF_INET, SOCK_STREAM, 0);
+ sfd = socket(AF_INET, SOCK_STREAM | SOCK_CLOEXEC, 0);
if (sfd < 0) {
perror("socket");
exit(EXIT_FAILURE);
diff --git a/idle.c b/idle.c
index 03d9f88..46be539 100644
--- a/idle.c
+++ b/idle.c
@@ -357,7 +357,7 @@ again:
fprintf(stderr, "%s: attempting idle check on %s (len %u)\n",
scfg->name, idle->remotestr, idle->remote.addrlen);
- sfd = socket(idle->remote.storage.ss_family, SOCK_STREAM, 0);
+ sfd = socket(idle->remote.storage.ss_family, SOCK_STREAM | SOCK_CLOEXEC, 0);
if (sfd < 0) {
perror("socket");
goto again;
diff --git a/proxy.c b/proxy.c
index dcae9b6..1ec9541 100644
--- a/proxy.c
+++ b/proxy.c
@@ -230,7 +230,7 @@ again:
fprintf(stderr, "%s: attempting proxy connection to %s (len %u)\n",
scfg->name, proxy->serverstr, proxy->server.addrlen);
- sfd = socket(proxy->server.storage.ss_family, SOCK_STREAM, 0);
+ sfd = socket(proxy->server.storage.ss_family, SOCK_STREAM | SOCK_CLOEXEC, 0);
if (sfd < 0) {
perror("socket");
goto again;
diff --git a/rcon.c b/rcon.c
index 02fd021..a1fd90f 100644
--- a/rcon.c
+++ b/rcon.c
@@ -366,7 +366,7 @@ again:
fprintf(stderr, "%s: attempting rcon connection to %s (len %u)\n",
scfg->name, rcon->rconstr, rcon->rcon.addrlen);
- sfd = socket(rcon->rcon.storage.ss_family, SOCK_STREAM, 0);
+ sfd = socket(rcon->rcon.storage.ss_family, SOCK_STREAM | SOCK_CLOEXEC, 0);
if (sfd < 0) {
perror("socket");
goto again;
diff --git a/server.c b/server.c
index 7a0dc5b..0298491 100644
--- a/server.c
+++ b/server.c
@@ -215,7 +215,7 @@ server_local_open(struct cfg *cfg, struct server *scfg, struct server_local *loc
int enable = 1;
int r;
- sfd = socket(local->addr.storage.ss_family, SOCK_STREAM, 0);
+ sfd = socket(local->addr.storage.ss_family, SOCK_STREAM | SOCK_CLOEXEC, 0);
if (sfd < 0) {
perror("socket");
goto out;
diff --git a/stest.c b/stest.c
index d60ae74..94b5264 100644
--- a/stest.c
+++ b/stest.c
@@ -30,7 +30,7 @@ main(int argc, char **argv) {
exit(EXIT_FAILURE);
}
- sfd = socket(AF_INET, SOCK_STREAM, 0);
+ sfd = socket(AF_INET, SOCK_STREAM | SOCK_CLOEXEC, 0);
if (sfd < 0) {
perror("socket");
exit(EXIT_FAILURE);