diff mbox series

[4/6] progress_thread: set progress bar connection fd as CLOEXEC

Message ID 20220527044700.3666830-5-dominique.martinet@atmark-techno.com
State Accepted
Headers show
Series Avoid leaking fd to child processes: use CLOEXEC | expand

Commit Message

Dominique Martinet May 27, 2022, 4:46 a.m. UTC
Signed-off-by: Dominique Martinet <dominique.martinet@atmark-techno.com>
---
 core/progress_thread.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Stefano Babic June 5, 2022, 2:15 p.m. UTC | #1
On 27.05.22 06:46, Dominique Martinet wrote:
> Signed-off-by: Dominique Martinet <dominique.martinet@atmark-techno.com>
> ---
>   core/progress_thread.c | 3 +++
>   1 file changed, 3 insertions(+)
> 
> diff --git a/core/progress_thread.c b/core/progress_thread.c
> index 5a3dc5ac6713..351644ca49d6 100644
> --- a/core/progress_thread.c
> +++ b/core/progress_thread.c
> @@ -271,6 +271,9 @@ void *progress_bar_thread (void __attribute__ ((__unused__)) *data)
>   			}
>   		}
>   
> +		if (fcntl(connfd, F_SETFD, FD_CLOEXEC) < 0)
> +			WARN("Could not set %d as cloexec: %s", connfd, strerror(errno));
> +
>   		/*
>   		 * Save the new connection to be handled by the progress thread
>   		 */


Reviewed-by: Stefano Babic <sbabic@denx.de>

Best regards,
Stefano Babic
diff mbox series

Patch

diff --git a/core/progress_thread.c b/core/progress_thread.c
index 5a3dc5ac6713..351644ca49d6 100644
--- a/core/progress_thread.c
+++ b/core/progress_thread.c
@@ -271,6 +271,9 @@  void *progress_bar_thread (void __attribute__ ((__unused__)) *data)
 			}
 		}
 
+		if (fcntl(connfd, F_SETFD, FD_CLOEXEC) < 0)
+			WARN("Could not set %d as cloexec: %s", connfd, strerror(errno));
+
 		/*
 		 * Save the new connection to be handled by the progress thread
 		 */