mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
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
This commit is contained in:
parent
93f8341792
commit
cdce1dd4ef
1 changed files with 9 additions and 16 deletions
25
process.c
25
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("/");
|
||||
|
|
Loading…
Reference in a new issue