[asterisk-commits] tilghman: trunk r102329 - in /trunk: ./ include/asterisk/ main/ utils/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Feb 4 15:15:19 CST 2008


Author: tilghman
Date: Mon Feb  4 15:15:18 2008
New Revision: 102329

URL: http://svn.digium.com/view/asterisk?view=rev&rev=102329
Log:
Merged revisions 102323 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r102323 | tilghman | 2008-02-04 15:06:09 -0600 (Mon, 04 Feb 2008) | 7 lines

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

........

Modified:
    trunk/   (props changed)
    trunk/configure
    trunk/configure.ac
    trunk/include/asterisk/autoconfig.h.in
    trunk/main/asterisk.c
    trunk/utils/muted.c

Propchange: trunk/
------------------------------------------------------------------------------
Binary property 'branch-1.4-merged' - no diff available.

Modified: trunk/configure.ac
URL: http://svn.digium.com/view/asterisk/trunk/configure.ac?view=diff&rev=102329&r1=102328&r2=102329
==============================================================================
--- trunk/configure.ac (original)
+++ trunk/configure.ac Mon Feb  4 15:15:18 2008
@@ -1128,6 +1128,8 @@
 AST_EXT_LIB_CHECK([X11], [X11], [XOpenDisplay], [X11/Xlib.h],,, [standard_path])
 AST_EXT_LIB_CHECK([X11], [X11], [XOpenDisplay], [X11/Xlib.h],, [-I/usr/X11R6/include], [X11R6])
 
+AC_CHECK_FILE(/sbin/launchd, AC_DEFINE([HAVE_SBIN_LAUNCHD], 1, [Define to 1 if your system has /sbin/launchd.]))
+
 PBX_GTK=0
 AST_EXT_TOOL_CHECK([GTK], [gtk], [--cflags gthread], [--libs gthread])
 

Modified: trunk/include/asterisk/autoconfig.h.in
URL: http://svn.digium.com/view/asterisk/trunk/include/asterisk/autoconfig.h.in?view=diff&rev=102329&r1=102328&r2=102329
==============================================================================
--- trunk/include/asterisk/autoconfig.h.in (original)
+++ trunk/include/asterisk/autoconfig.h.in Mon Feb  4 15:15:18 2008
@@ -678,6 +678,9 @@
 
 /* Define RTLD_NOLOAD headers version */
 #undef HAVE_RTLD_NOLOAD_VERSION
+
+/* Define to 1 if your system has /sbin/launchd. */
+#undef HAVE_SBIN_LAUNCHD
 
 /* Define if your system has the SDL libraries. */
 #undef HAVE_SDL
@@ -1172,9 +1175,6 @@
 #ifndef _POSIX_PTHREAD_SEMANTICS
 # undef _POSIX_PTHREAD_SEMANTICS
 #endif
-#ifndef _TANDEM_SOURCE
-# undef _TANDEM_SOURCE
-#endif
 
 /* Define like PROTOTYPES; this can be used by system headers. */
 #undef __PROTOTYPES

Modified: trunk/main/asterisk.c
URL: http://svn.digium.com/view/asterisk/trunk/main/asterisk.c?view=diff&rev=102329&r1=102328&r2=102329
==============================================================================
--- trunk/main/asterisk.c (original)
+++ trunk/main/asterisk.c Mon Feb  4 15:15:18 2008
@@ -3070,6 +3070,7 @@
 
 #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 */
@@ -3080,6 +3081,9 @@
 			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
 

Modified: trunk/utils/muted.c
URL: http://svn.digium.com/view/asterisk/trunk/utils/muted.c?view=diff&rev=102329&r1=102328&r2=102329
==============================================================================
--- trunk/utils/muted.c (original)
+++ trunk/utils/muted.c Mon Feb  4 15:15:18 2008
@@ -680,8 +680,14 @@
 		fclose(astf);
 		exit(1);
 	}
-	if (needfork)
+	if (needfork) {
+#ifndef HAVE_SBIN_LAUNCHD
 		daemon(0,0);
+#else
+		fprintf(stderr, "Mac OS X detected.  Use 'launchd -d muted -f' to launch.\n");
+		exit(1);
+#endif
+	}
 	for(;;) {
 		if (wait_event()) {
 			fclose(astf);




More information about the asterisk-commits mailing list