summaryrefslogtreecommitdiff
path: root/process.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-06-24 08:06:38 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-06-24 08:06:38 +0000
commit706335aa0beaf1477acc41e15543e412c760474e (patch)
treea8da4be2645f3b2188a6e23131f788d6a5017c21 /process.c
parentdd91beb3e1e39fdee5588419fc0da8b09fd70a06 (diff)
* process.c (proc_daemon): should not start timer thread
twice. fixed Bug#4920. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32221 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'process.c')
-rw-r--r--process.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/process.c b/process.c
index 4595ccf7b7..5170bec207 100644
--- a/process.c
+++ b/process.c
@@ -4806,10 +4806,7 @@ proc_setmaxgroups(VALUE obj, VALUE val)
#endif
#if defined(HAVE_DAEMON) || (defined(HAVE_FORK) && defined(HAVE_SETSID))
-#ifndef HAVE_DAEMON
static int rb_daemon(int nochdir, int noclose);
-#define daemon(nochdir, noclose) rb_daemon((nochdir), (noclose))
-#endif
/*
* call-seq:
@@ -4835,18 +4832,21 @@ proc_daemon(int argc, VALUE *argv)
rb_scan_args(argc, argv, "02", &nochdir, &noclose);
prefork();
- before_fork();
- n = daemon(RTEST(nochdir), RTEST(noclose));
- after_fork();
+ n = rb_daemon(RTEST(nochdir), RTEST(noclose));
if (n < 0) rb_sys_fail("daemon");
return INT2FIX(n);
}
-#ifndef HAVE_DAEMON
static int
rb_daemon(int nochdir, int noclose)
{
- int n, err = 0;
+ int err = 0;
+#ifdef HAVE_DAEMON
+ before_fork();
+ err = daemon(nochdir, noclose);
+ after_fork();
+#else
+ int n;
switch (rb_fork(0, 0, 0, Qnil)) {
case -1:
@@ -4880,8 +4880,8 @@ rb_daemon(int nochdir, int noclose)
(void)close (n);
}
return err;
-}
#endif
+}
#else
#define proc_daemon rb_f_notimplement
#endif