1 diff -Nru asterisk-1.6.1-beta4.org/main/asterisk.c asterisk-1.6.1-beta4/main/asterisk.c
2 --- asterisk-1.6.1-beta4.org/main/asterisk.c 2008-12-12 23:05:58.000000000 +0100
3 +++ asterisk-1.6.1-beta4/main/asterisk.c 2008-12-23 15:28:21.000000000 +0100
6 if (ast_opt_always_fork || !ast_opt_no_fork) {
7 #ifndef HAVE_SBIN_LAUNCHD
9 if (daemon(1, 0) < 0) {
10 ast_log(LOG_ERROR, "daemon() failed: %s\n", strerror(errno));
14 + * workaround for uClibc-0.9.29 mipsel bug:
15 + * recursive mutexes do not work if uClibc daemon() function has been called,
16 + * if parent thread locks a mutex
17 + * the child thread cannot acquire a lock with the same name
18 + * (same code works if daemon() is not called)
19 + * but duplication of uClibc daemon.c code in here does work.
34 + if ((fd = open("/dev/null", O_RDWR, 0)) != -1) {
35 + dup2(fd, STDIN_FILENO);
36 + dup2(fd, STDOUT_FILENO);
37 + dup2(fd, STDERR_FILENO);
42 ast_mainpid = getpid();
43 /* Blindly re-write pid file since we are forking */
44 unlink(ast_config_AST_PID);