[Asterisk-cvs] asterisk/res res_musiconhold.c,1.8,1.9
markster at lists.digium.com
markster at lists.digium.com
Tue Sep 16 14:34:49 CDT 2003
Update of /usr/cvsroot/asterisk/res
In directory mongoose.digium.com:/tmp/cvs-serv23699/res
Modified Files:
res_musiconhold.c
Log Message:
Improve child process reaping (bug #278)
Index: res_musiconhold.c
===================================================================
RCS file: /usr/cvsroot/asterisk/res/res_musiconhold.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- res_musiconhold.c 8 Sep 2003 16:48:07 -0000 1.8
+++ res_musiconhold.c 16 Sep 2003 19:35:57 -0000 1.9
@@ -94,17 +94,10 @@
static ast_mutex_t moh_lock = AST_MUTEX_INITIALIZER;
+#define LOCAL_MPG_123 "/usr/local/bin/mpg123"
#define MPG_123 "/usr/bin/mpg123"
#define MAX_MP3S 256
-static void child_handler(int sig)
-{
- int status;
- if (wait4(-1,&status, WNOHANG, NULL)<1)
- if (option_debug)
- ast_log(LOG_DEBUG, "Huh? Child handler, but nobody there?\n");
-}
-
static int spawn_mp3(struct mohclass *class)
{
int fds[2];
@@ -121,7 +114,7 @@
ast_log(LOG_WARNING, "%s is not a valid directory\n", class->dir);
return -1;
}
- argv[0] = MPG_123;
+ argv[0] = "mpg123";
argv[1] = "-q";
argv[2] = "-s";
argv[3] = "--mono";
@@ -190,7 +183,12 @@
close(x);
/* Child */
chdir(class->dir);
+ /* Default install is /usr/local/bin */
+ execv(LOCAL_MPG_123, argv);
+ /* Many places have it in /usr/bin */
execv(MPG_123, argv);
+ /* Check PATH as a last-ditch effort */
+ execvp("mpg123", argv);
ast_log(LOG_WARNING, "Exec failed: %s\n", strerror(errno));
exit(1);
} else {
@@ -220,7 +218,6 @@
tv.tv_usec = 0;
error_sec = 0;
error_usec = 0;
- signal(SIGCHLD, child_handler);
for(;/* ever */;) {
/* Spawn mp3 player if it's not there */
if (class->srcfd < 0) {
More information about the svn-commits
mailing list