diff options
| author | yugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-05-04 12:31:33 +0000 |
|---|---|---|
| committer | yugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-05-04 12:31:33 +0000 |
| commit | 9ca4e66f27e2563512afdd4c70afab34d80d513d (patch) | |
| tree | 50b2c59e65ced47367cb333f54264cea095fc72d | |
| parent | 1f69d94690edc49856c79a197899cd8b4e109319 (diff) | |
merges r23277 and r23280 from trunk into ruby_1_9_1.
--
* 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]
--
* 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:23305]
git-svn-id: http://svn.ruby-lang.org/repos/ruby/branches/ruby_1_9_1@23343 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
| -rw-r--r-- | ChangeLog | 7 | ||||
| -rw-r--r-- | configure.in | 9 | ||||
| -rw-r--r-- | process.c | 12 |
3 files changed, 26 insertions, 2 deletions
@@ -1,3 +1,10 @@ +Sat Apr 25 19:11:13 2009 Nobuyoshi Nakada <nobu@ruby-lang.org> + + * 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:23305] + Sun Apr 19 14:43:18 2009 Nobuyoshi Nakada <nobu@ruby-lang.org> * eval.c (ruby_cleanup): the order of local variables on stack is diff --git a/configure.in b/configure.in index 5ddea5d41..3b79bec80 100644 --- a/configure.in +++ b/configure.in @@ -518,6 +518,14 @@ AC_ARG_ENABLE(pthread, dnl Checks for libraries. case "$target_os" in +*bsd*|dragonfly*) + ;; +*) + ac_cv_func_daemon=no + ;; +esac + +case "$target_os" in nextstep*) ;; openstep*) ;; rhapsody*) ;; @@ -531,7 +539,6 @@ darwin*) LIBS="-lobjc $LIBS" ], [ ac_cv_header_ucontext_h=no - ac_cv_func_daemon=no ], [ AC_DEFINE(BROKEN_SETREUID, 1) @@ -4216,7 +4216,7 @@ proc_daemon(int argc, VALUE *argv) #elif defined(HAVE_FORK) switch (rb_fork(0, 0, 0, Qnil)) { case -1: - return (-1); + return INT2FIX(-1); case 0: break; default: @@ -4225,6 +4225,16 @@ proc_daemon(int argc, VALUE *argv) 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("/"); |
