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: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_1@23343 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
yugui 2009-05-04 12:31:33 +00:00
parent 18d1ea6cc8
commit 331ce20e8e
3 changed files with 26 additions and 2 deletions

View file

@ -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

View file

@ -517,6 +517,14 @@ AC_ARG_ENABLE(pthread,
[enable_pthread=$enableval], [enable_pthread=$enable_pthread_default])
dnl Checks for libraries.
case "$target_os" in
*bsd*|dragonfly*)
;;
*)
ac_cv_func_daemon=no
;;
esac
case "$target_os" in
nextstep*) ;;
openstep*) ;;
@ -531,7 +539,6 @@ darwin*) LIBS="-lobjc $LIBS"
],
[
ac_cv_header_ucontext_h=no
ac_cv_func_daemon=no
],
[
AC_DEFINE(BROKEN_SETREUID, 1)

View file

@ -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("/");