diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-05-01 03:14:55 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-05-01 03:14:55 +0000 |
commit | cdce1dd4efc2ee6bf8f1b0186aa9be755a5bfa89 (patch) | |
tree | e9addcb6b687dd4e2ce57a78a5d5d7219dc7d55d | |
parent | 93f83417928d0b12020949cd02deb96340e70448 (diff) | |
download | ruby-cdce1dd4efc2ee6bf8f1b0186aa9be755a5bfa89.tar.gz |
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
-rw-r--r-- | process.c | 25 |
1 files changed, 9 insertions, 16 deletions
@@ -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("/"); |