summaryrefslogtreecommitdiff
path: root/process.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-05-01 03:14:55 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-05-01 03:14:55 +0000
commitcdce1dd4efc2ee6bf8f1b0186aa9be755a5bfa89 (patch)
treee9addcb6b687dd4e2ce57a78a5d5d7219dc7d55d /process.c
parent93f83417928d0b12020949cd02deb96340e70448 (diff)
process.c: rb_daemon should not raise
* process.c (rb_daemon): should not raise exceptions, since proc_daemon() will deal with errors. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40534 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'process.c')
-rw-r--r--process.c25
1 files changed, 9 insertions, 16 deletions
diff --git a/process.c b/process.c
index c608721713..753e27ec09 100644
--- a/process.c
+++ b/process.c
@@ -5676,26 +5676,19 @@ rb_daemon(int nochdir, int noclose)
#else
int n;
- switch (rb_fork_ruby(NULL)) {
- case -1:
- rb_sys_fail("daemon");
- case 0:
- break;
- default:
- _exit(EXIT_SUCCESS);
+#define fork_daemon() \
+ switch (rb_fork_ruby(NULL)) { \
+ case -1: return -1; \
+ case 0: break; \
+ default: _exit(EXIT_SUCCESS); \
}
- proc_setsid();
+ fork_daemon();
+
+ if (setsid() < 0) return -1;
/* must not be process-leader */
- switch (rb_fork_ruby(NULL)) {
- case -1:
- return -1;
- case 0:
- break;
- default:
- _exit(EXIT_SUCCESS);
- }
+ fork_daemon();
if (!nochdir)
err = chdir("/");