[v4,1/2] libcamera: process: Use _exit in child process
diff mbox series

Message ID 20250527155615.560463-2-julien.vuillaumier@nxp.com
State New
Headers show
Series
  • libcamera: process: Pass stderr and reserve stdin and stdout fds
Related show

Commit Message

Julien Vuillaumier May 27, 2025, 3:56 p.m. UTC
Use _exit() in child process in case of execv() error. That is to
avoid interfering with the parent process as exit() may call its
atexit() handlers and flush its io buffers.

Signed-off-by: Julien Vuillaumier <julien.vuillaumier@nxp.com>
---
 src/libcamera/process.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Kieran Bingham May 27, 2025, 4:03 p.m. UTC | #1
Quoting Julien Vuillaumier (2025-05-27 16:56:14)
> Use _exit() in child process in case of execv() error. That is to
> avoid interfering with the parent process as exit() may call its
> atexit() handlers and flush its io buffers.
> 
> Signed-off-by: Julien Vuillaumier <julien.vuillaumier@nxp.com>
> ---
>  src/libcamera/process.cpp | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/libcamera/process.cpp b/src/libcamera/process.cpp
> index 68fad327..7f3a6518 100644
> --- a/src/libcamera/process.cpp
> +++ b/src/libcamera/process.cpp
> @@ -274,7 +274,7 @@ int Process::start(const std::string &path,
>  
>                 execv(path.c_str(), (char **)argv);
>  
> -               exit(EXIT_FAILURE);
> +               _exit(EXIT_FAILURE);

Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>

>         }
>  }
>  
> -- 
> 2.34.1
>

Patch
diff mbox series

diff --git a/src/libcamera/process.cpp b/src/libcamera/process.cpp
index 68fad327..7f3a6518 100644
--- a/src/libcamera/process.cpp
+++ b/src/libcamera/process.cpp
@@ -274,7 +274,7 @@  int Process::start(const std::string &path,
 
 		execv(path.c_str(), (char **)argv);
 
-		exit(EXIT_FAILURE);
+		_exit(EXIT_FAILURE);
 	}
 }