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 | 331ce20e8e9e1d4f26cd8202eff2418ab80cb879 (patch) | |
tree | 50b2c59e65ced47367cb333f54264cea095fc72d /process.c | |
parent | 18d1ea6cc83ee236f9d8368fa5cb68af839f03e8 (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: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_1@23343 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'process.c')
-rw-r--r-- | process.c | 12 |
1 files changed, 11 insertions, 1 deletions
@@ -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("/"); |