aboutsummaryrefslogtreecommitdiffstats
path: root/main/asterisk.c
diff options
context:
space:
mode:
authortilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2008-02-04 21:06:09 +0000
committertilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2008-02-04 21:06:09 +0000
commite706637b7b65408f74f93c11b60f017d32ecbd64 (patch)
tree82bb549e5a3bbfc54a0a95bfca966183f9521d1b /main/asterisk.c
parent40fac56fb744fcccb19f7a2b65cd0f3c03c8cf30 (diff)
Cross-platform fix: OS X now deprecates the use of the daemon(3) API.
(closes issue #11908) Reported by: oej Patches: 20080204__bug11908.diff.txt uploaded by Corydon76 (license 14) Tested by: Corydon76 git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@102323 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 fe7271a1f..ecfca97d4 100644
--- a/main/asterisk.c
+++ b/main/asterisk.c
@@ -2844,6 +2844,7 @@ int main(int argc, char *argv[])
#if HAVE_WORKING_FORK
if (ast_opt_always_fork || !ast_opt_no_fork) {
+#ifndef HAVE_SBIN_LAUNCHD
daemon(1, 0);
ast_mainpid = getpid();
/* Blindly re-write pid file since we are forking */
@@ -2854,6 +2855,9 @@ int main(int argc, char *argv[])
fclose(f);
} else
ast_log(LOG_WARNING, "Unable to open pid file '%s': %s\n", ast_config_AST_PID, strerror(errno));
+#else
+ ast_log(LOG_WARNING, "Mac OS X detected. Use '/sbin/launchd -d' to launch with the nofork option.\n");
+#endif
}
#endif