ast_safe_system() forks real time processes

There’s a problem if you start asterisk with option -p for real time priority. A call to ast_safe_system() will cause the subprocess also to get real time priority, making the system to lock up if the program running in the subprocesses need cpu time.

Typical cases would be when you fork from CLI, everything you run goes into real time queue and may block the system, or when you call an mp3-encoder from MONITOR_EXEC, everything else will be blocked. I guess most applications called from ast_safe_system() are not suitable for real time, so I suggest this;

(version 1.2.6, revision 11609)


*** asterisk.c.orig     2006-04-24 08:58:52.000000000 +0200
--- asterisk.c  2006-04-24 09:05:26.000000000 +0200
***************
*** 443,448 ****
--- 443,451 ----
        pid = fork();

        if (pid == 0) {
+               /* Do not run in real time queue */
+               if (option_highpriority)
+                       ast_set_priority(0);
                /* Close file descriptors and launch system command */
                for (x = STDERR_FILENO + 1; x < 4096; x++)
                        close(x);