Skip to content
Snippets Groups Projects
Commit 1dc86caf authored by Tilghman Lesher's avatar Tilghman Lesher
Browse files

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

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@102329 65c4cc65-6c06-0410-ace0-fbb531ad65f3
parent 668cecba
No related branches found
No related tags found
No related merge requests found
Source diff could not be displayed: it is too large. Options to address this: view the blob.
...@@ -1128,6 +1128,8 @@ AC_CHECK_HEADER([linux/videodev.h], ...@@ -1128,6 +1128,8 @@ AC_CHECK_HEADER([linux/videodev.h],
AST_EXT_LIB_CHECK([X11], [X11], [XOpenDisplay], [X11/Xlib.h],,, [standard_path]) 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]) 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 PBX_GTK=0
AST_EXT_TOOL_CHECK([GTK], [gtk], [--cflags gthread], [--libs gthread]) AST_EXT_TOOL_CHECK([GTK], [gtk], [--cflags gthread], [--libs gthread])
......
...@@ -679,6 +679,9 @@ ...@@ -679,6 +679,9 @@
/* Define RTLD_NOLOAD headers version */ /* Define RTLD_NOLOAD headers version */
#undef HAVE_RTLD_NOLOAD_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. */ /* Define if your system has the SDL libraries. */
#undef HAVE_SDL #undef HAVE_SDL
...@@ -1172,9 +1175,6 @@ ...@@ -1172,9 +1175,6 @@
#ifndef _POSIX_PTHREAD_SEMANTICS #ifndef _POSIX_PTHREAD_SEMANTICS
# undef _POSIX_PTHREAD_SEMANTICS # undef _POSIX_PTHREAD_SEMANTICS
#endif #endif
#ifndef _TANDEM_SOURCE
# undef _TANDEM_SOURCE
#endif
/* Define like PROTOTYPES; this can be used by system headers. */ /* Define like PROTOTYPES; this can be used by system headers. */
#undef __PROTOTYPES #undef __PROTOTYPES
......
...@@ -3070,6 +3070,7 @@ int main(int argc, char *argv[]) ...@@ -3070,6 +3070,7 @@ int main(int argc, char *argv[])
#if HAVE_WORKING_FORK #if HAVE_WORKING_FORK
if (ast_opt_always_fork || !ast_opt_no_fork) { if (ast_opt_always_fork || !ast_opt_no_fork) {
#ifndef HAVE_SBIN_LAUNCHD
daemon(1, 0); daemon(1, 0);
ast_mainpid = getpid(); ast_mainpid = getpid();
/* Blindly re-write pid file since we are forking */ /* Blindly re-write pid file since we are forking */
...@@ -3080,6 +3081,9 @@ int main(int argc, char *argv[]) ...@@ -3080,6 +3081,9 @@ int main(int argc, char *argv[])
fclose(f); fclose(f);
} else } else
ast_log(LOG_WARNING, "Unable to open pid file '%s': %s\n", ast_config_AST_PID, strerror(errno)); 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 #endif
......
...@@ -680,8 +680,14 @@ int main(int argc, char *argv[]) ...@@ -680,8 +680,14 @@ int main(int argc, char *argv[])
fclose(astf); fclose(astf);
exit(1); exit(1);
} }
if (needfork) if (needfork) {
#ifndef HAVE_SBIN_LAUNCHD
daemon(0,0); daemon(0,0);
#else
fprintf(stderr, "Mac OS X detected. Use 'launchd -d muted -f' to launch.\n");
exit(1);
#endif
}
for(;;) { for(;;) {
if (wait_event()) { if (wait_event()) {
fclose(astf); fclose(astf);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment