summaryrefslogtreecommitdiffstats
path: root/polyp/socket-server.c
diff options
context:
space:
mode:
Diffstat (limited to 'polyp/socket-server.c')
-rw-r--r--polyp/socket-server.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/polyp/socket-server.c b/polyp/socket-server.c
index f01e417c..131339ed 100644
--- a/polyp/socket-server.c
+++ b/polyp/socket-server.c
@@ -38,6 +38,7 @@
#include "socket-server.h"
#include "socket-util.h"
#include "xmalloc.h"
+#include "util.h"
struct pa_socket_server {
int ref;
@@ -65,6 +66,8 @@ static void callback(struct pa_mainloop_api *mainloop, struct pa_io_event *e, in
goto finish;
}
+ pa_fd_set_cloexec(nfd, 1);
+
if (!s->on_connection) {
close(nfd);
goto finish;
@@ -122,6 +125,8 @@ struct pa_socket_server* pa_socket_server_new_unix(struct pa_mainloop_api *m, co
goto fail;
}
+ pa_fd_set_cloexec(fd, 1);
+
sa.sun_family = AF_LOCAL;
strncpy(sa.sun_path, filename, sizeof(sa.sun_path)-1);
sa.sun_path[sizeof(sa.sun_path) - 1] = 0;
@@ -166,6 +171,8 @@ struct pa_socket_server* pa_socket_server_new_ipv4(struct pa_mainloop_api *m, ui
goto fail;
}
+ pa_fd_set_cloexec(fd, 1);
+
if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &on, sizeof(on)) < 0)
fprintf(stderr, "setsockopt(): %s\n", strerror(errno));