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
|
#else
|
||||||
int n;
|
int n;
|
||||||
|
|
||||||
switch (rb_fork_ruby(NULL)) {
|
#define fork_daemon() \
|
||||||
case -1:
|
switch (rb_fork_ruby(NULL)) { \
|
||||||
rb_sys_fail("daemon");
|
case -1: return -1; \
|
||||||
case 0:
|
case 0: break; \
|
||||||
break;
|
default: _exit(EXIT_SUCCESS); \
|
||||||
default:
|
|
||||||
_exit(EXIT_SUCCESS);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
proc_setsid();
|
fork_daemon();
|
||||||
|
|
||||||
|
if (setsid() < 0) return -1;
|
||||||
|
|
||||||
/* must not be process-leader */
|
/* must not be process-leader */
|
||||||
switch (rb_fork_ruby(NULL)) {
|
fork_daemon();
|
||||||
case -1:
|
|
||||||
return -1;
|
|
||||||
case 0:
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
_exit(EXIT_SUCCESS);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!nochdir)
|
if (!nochdir)
|
||||||
err = chdir("/");
|
err = chdir("/");
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue