aboutsummaryrefslogtreecommitdiffstats
path: root/main/asterisk.c
diff options
context:
space:
mode:
authorfile <file@f38db490-d61c-443f-a65b-d21fe96a405b>2006-10-18 21:03:34 +0000
committerfile <file@f38db490-d61c-443f-a65b-d21fe96a405b>2006-10-18 21:03:34 +0000
commit4114f4c285a00a1852a1c9a428a8ebdcf3d2bd59 (patch)
tree7f1bd6542aa9cc62688b46aba62acb05b7f19294 /main/asterisk.c
parent3a03a75ec8d789f31f88c74fdcf3788b2651d45d (diff)
Don't modify things if we are using vfork as this is very bad and may cause unexpected behavior (issue #7970 reported by Nick Gavrikov)
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@45595 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'main/asterisk.c')
-rw-r--r--main/asterisk.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/main/asterisk.c b/main/asterisk.c
index 75426fe4e..941d21129 100644
--- a/main/asterisk.c
+++ b/main/asterisk.c
@@ -690,7 +690,9 @@ void ast_unreplace_sigchld(void)
int ast_safe_system(const char *s)
{
pid_t pid;
+#ifdef HAVE_WORKING_FORK
int x;
+#endif
int res;
struct rusage rusage;
int status;
@@ -705,11 +707,13 @@ int ast_safe_system(const char *s)
#endif
if (pid == 0) {
+#ifdef HAVE_WORKING_FORK
if (ast_opt_high_priority)
ast_set_priority(0);
/* Close file descriptors and launch system command */
for (x = STDERR_FILENO + 1; x < 4096; x++)
close(x);
+#endif
execl("/bin/sh", "/bin/sh", "-c", s, (char *) NULL);
exit(1);
} else if (pid > 0) {