mirror of
https://git.proxmox.com/git/grub2
synced 2025-07-25 16:08:26 +00:00
osdep/unix/exec: Avoid atexit() handlers when child execvp() fails
The functions grub_util_exec_pipe() and grub_util_exec_pipe_stderr()
currently call execvp(). If the call fails for any reason, the child
currently calls exit(127). This in turn executes the parents
atexit() handlers from the forked child, and then the same handlers
are called again from parent. This is usually not desired, and can
lead to deadlocks, and undesired behavior. So, change the exit() calls
to _exit() calls to avoid calling atexit() handlers from child.
Fixes: e75cf4a58
(unix exec: avoid atexit handlers when child exits)
Signed-off-by: Dimitri John Ledkov <xnox@ubuntu.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
This commit is contained in:
parent
80948f532d
commit
7da1d0dde1
@ -188,7 +188,7 @@ grub_util_exec_pipe (const char *const *argv, int *fd)
|
||||
close (pipe_fd[1]);
|
||||
|
||||
execvp ((char *) argv[0], (char **) argv);
|
||||
exit (127);
|
||||
_exit (127);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -234,7 +234,7 @@ grub_util_exec_pipe_stderr (const char *const *argv, int *fd)
|
||||
close (pipe_fd[1]);
|
||||
|
||||
execvp ((char *) argv[0], (char **) argv);
|
||||
exit (127);
|
||||
_exit (127);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user