[前][次][番号順一覧][スレッド一覧]

ruby-changes:11639

From: nobu <ko1@a...>
Date: Sat, 25 Apr 2009 18:22:05 +0900 (JST)
Subject: [ruby-changes:11639] Ruby:r23277 (trunk): * configure.in (ac_cv_func_daemon): use daemon(3) only on *BSD.

nobu	2009-04-25 18:21:49 +0900 (Sat, 25 Apr 2009)

  New Revision: 23277

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=23277

  Log:
    * configure.in (ac_cv_func_daemon): use daemon(3) only on *BSD.
    * process.c (proc_daemon): double fork to ensure not having ctty.
      [ruby-core:23311]

  Modified files:
    trunk/ChangeLog
    trunk/configure.in
    trunk/process.c

Index: configure.in
===================================================================
--- configure.in	(revision 23276)
+++ configure.in	(revision 23277)
@@ -728,6 +728,14 @@
 
 dnl Checks for libraries.
 case "$target_os" in
+when(*bsd*|dragonfly*)
+    ;;
+when(*)
+    ac_cv_func_daemon=no
+    ;;
+esac
+
+case "$target_os" in
 when(nextstep*)	;;
 when(openstep*)	;;
 when(rhapsody*)	;;
@@ -744,7 +752,6 @@
 		AC_MSG_RESULT($macosx_10_5)
 		if test $macosx_10_5 = yes; then
 		    ac_cv_header_ucontext_h=no
-		    ac_cv_func_daemon=no
 		else
 		    AC_DEFINE(BROKEN_SETREUID, 1)
 		    AC_DEFINE(BROKEN_SETREGID, 1)
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 23276)
+++ ChangeLog	(revision 23277)
@@ -1,3 +1,10 @@
+Sat Apr 25 18:21:47 2009  Nobuyoshi Nakada  <nobu@r...>
+
+	* configure.in (ac_cv_func_daemon): use daemon(3) only on *BSD.
+
+	* process.c (proc_daemon): double fork to ensure not having ctty.
+	  [ruby-core:23311]
+
 Sat Apr 25 16:19:48 2009  Tanaka Akira  <akr@f...>
 
 	* time.c (month_arg): extracted from time_arg.
Index: process.c
===================================================================
--- process.c	(revision 23276)
+++ process.c	(revision 23277)
@@ -4545,7 +4545,7 @@
 #elif defined(HAVE_FORK)
     switch (rb_fork(0, 0, 0, Qnil)) {
       case -1:
-	return (-1);
+	return INT2FIX(-1);
       case 0:
 	break;
       default:
@@ -4554,6 +4554,16 @@
 
     proc_setsid();
 
+    /* must not be process-leader */
+    switch (rb_fork(0, 0, 0, Qnil)) {
+      case -1:
+	return INT2FIX(-1);
+      case 0:
+	break;
+      default:
+	_exit(0);
+    }
+
     if (!RTEST(nochdir))
 	(void)chdir("/");
 

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]