mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-04 03:50:31 +00:00
We should always be using _exit() after a fork() or vfork() instead of exit().
This is because exit() does some extra cleanup which in some implementations of vfork(), for example, can actually modify the state of the parent process, causing very weird bugs or crashes. (issue #7971, Nick Gavrikov) git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.2@46361 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -297,7 +297,7 @@ static int launch_script(char *script, char *argv[], int *fds, int *efd, int *op
|
||||
/* unblock important signal handlers */
|
||||
if (sigfillset(&signal_set) || pthread_sigmask(SIG_UNBLOCK, &signal_set, NULL)) {
|
||||
ast_log(LOG_WARNING, "unable to unblock signals for AGI script: %s\n", strerror(errno));
|
||||
exit(1);
|
||||
_exit(1);
|
||||
}
|
||||
|
||||
/* Close everything but stdin/out/error */
|
||||
@@ -308,7 +308,7 @@ static int launch_script(char *script, char *argv[], int *fds, int *efd, int *op
|
||||
execv(script, argv);
|
||||
/* Can't use ast_log since FD's are closed */
|
||||
fprintf(stderr, "Failed to execute '%s': %s\n", script, strerror(errno));
|
||||
exit(1);
|
||||
_exit(1);
|
||||
}
|
||||
if (option_verbose > 2)
|
||||
ast_verbose(VERBOSE_PREFIX_3 "Launched AGI Script %s\n", script);
|
||||
|
@@ -463,7 +463,7 @@ static int spawn_mp3(struct mohclass *class)
|
||||
}
|
||||
ast_log(LOG_WARNING, "Exec failed: %s\n", strerror(errno));
|
||||
close(fds[1]);
|
||||
exit(1);
|
||||
_exit(1);
|
||||
} else {
|
||||
/* Parent */
|
||||
close(fds[1]);
|
||||
|
Reference in New Issue
Block a user