[前][次][番号順一覧][スレッド一覧]

ruby-changes:28482

From: nobu <ko1@a...>
Date: Wed, 1 May 2013 12:15:08 +0900 (JST)
Subject: [ruby-changes:28482] nobu:r40534 (trunk): process.c: rb_daemon should not raise

nobu	2013-05-01 12:14:55 +0900 (Wed, 01 May 2013)

  New Revision: 40534

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=40534

  Log:
    process.c: rb_daemon should not raise
    
    * process.c (rb_daemon): should not raise exceptions, since
      proc_daemon() will deal with errors.

  Modified files:
    trunk/process.c

Index: process.c
===================================================================
--- process.c	(revision 40533)
+++ process.c	(revision 40534)
@@ -5676,26 +5676,19 @@ rb_daemon(int nochdir, int noclose) https://github.com/ruby/ruby/blob/trunk/process.c#L5676
 #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("/");

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]