mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-03 09:01:50 -05:00
make use F_CLOEXEC wherever useful
git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@174 fefdeb5f-60dc-0310-8127-8f9354f1896f
This commit is contained in:
parent
348738751c
commit
5f52999c01
9 changed files with 35 additions and 1 deletions
|
|
@ -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));
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue