diff mbox series

[2/2] spawn_process: use CLOEXEC for child communication fd

Message ID 20230915091608.3207005-2-dominique.martinet@atmark-techno.com
State Accepted
Delegated to: Stefano Babic
Headers show
Series [1/2] prepare_ipc: set client fd as CLOEXEC | expand

Commit Message

Dominique MARTINET Sept. 15, 2023, 9:16 a.m. UTC
avoid leaking sw_sockfd to child processes

Signed-off-by: Dominique Martinet <dominique.martinet@atmark-techno.com>
---
 core/pctl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/core/pctl.c b/core/pctl.c
index 2384cd3e4120..1de2903a8aa3 100644
--- a/core/pctl.c
+++ b/core/pctl.c
@@ -136,7 +136,7 @@  static int spawn_process(struct swupdate_task *task,
 	/*
 	 * Create the pipe to exchange data with the child
 	 */
-	if (socketpair(AF_UNIX, SOCK_STREAM, 0, sockfd) < 0) {
+	if (socketpair(AF_UNIX, SOCK_STREAM | SOCK_CLOEXEC, 0, sockfd) < 0) {
 		ERROR("socketpair fails : %s", strerror(errno));
 		return -1;
 	}