treewide: make more file descriptors cloexec

Avoid file descriptor leakage into child processes by marking them `O_CLOEXEC`.
This commit is contained in:
Barnabás Pőcze 2025-10-28 20:03:13 +01:00
parent 8344117e7b
commit ccfb61efa4
9 changed files with 11 additions and 11 deletions

View file

@ -263,7 +263,7 @@ int main(int argc, char *argv[])
spa_assert_se(loop != NULL);
context = pw_context_new(pw_main_loop_get_loop(loop), NULL, 0);
if (socketpair(AF_UNIX, SOCK_STREAM, 0, fds) < 0) {
if (socketpair(AF_UNIX, SOCK_STREAM | SOCK_CLOEXEC, 0, fds) < 0) {
spa_assert_not_reached();
return -1;
}
@ -286,7 +286,7 @@ int main(int argc, char *argv[])
int fds2[2];
struct pw_protocol_native_connection *in2, *out2;
if (socketpair(AF_UNIX, SOCK_STREAM, 0, fds2) < 0)
if (socketpair(AF_UNIX, SOCK_STREAM | SOCK_CLOEXEC, 0, fds2) < 0)
spa_assert_not_reached();
in2 = pw_protocol_native_connection_new(context, fds2[0]);