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

ruby-changes:15224

From: knu <ko1@a...>
Date: Tue, 30 Mar 2010 14:00:34 +0900 (JST)
Subject: [ruby-changes:15224] Ruby:r27106 (trunk): * process.c (proc_daemon): Process.daemon should raise an error on

knu	2010-03-30 14:00:15 +0900 (Tue, 30 Mar 2010)

  New Revision: 27106

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

  Log:
    * process.c (proc_daemon): Process.daemon should raise an error on
      failure regardless of whether the implementation uses daemon(3)
      or not. [ruby-dev:40832]

  Modified files:
    trunk/ChangeLog
    trunk/process.c

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 27105)
+++ ChangeLog	(revision 27106)
@@ -1,3 +1,9 @@
+Tue Mar 30 13:57:08 2010  Akinori MUSHA  <knu@i...>
+
+	* process.c (proc_daemon): Process.daemon should raise an error on
+	  failure regardless of whether the implementation uses daemon(3)
+	  or not. [ruby-dev:40832]
+
 Tue Mar 30 13:11:17 2010  Nobuyoshi Nakada  <nobu@r...>
 
 	* tool/file2lastrev.rb (VCS::GIT_SVN): removed because git-log can
Index: process.c
===================================================================
--- process.c	(revision 27105)
+++ process.c	(revision 27106)
@@ -4531,8 +4531,8 @@
 #if defined(HAVE_DAEMON) || defined(HAVE_FORK)
 /*
  *  call-seq:
- *     Process.daemon()                        => fixnum
- *     Process.daemon(nochdir=nil,noclose=nil) => fixnum
+ *     Process.daemon()                        => 0
+ *     Process.daemon(nochdir=nil,noclose=nil) => 0
  *
  *  Detach the process from controlling terminal and run in
  *  the background as system daemon.  Unless the argument
@@ -4540,6 +4540,7 @@
  *  working directory to the root ("/"). Unless the argument
  *  noclose is true, daemon() will redirect standard input,
  *  standard output and standard error to /dev/null.
+ *  Return zero on success, or raise one of Errno::*.
  */
 
 static VALUE
@@ -4561,7 +4562,7 @@
 #elif defined(HAVE_FORK)
     switch (rb_fork(0, 0, 0, Qnil)) {
       case -1:
-	return INT2FIX(-1);
+	rb_sys_fail("daemon");
       case 0:
 	break;
       default:
@@ -4573,7 +4574,7 @@
     /* must not be process-leader */
     switch (rb_fork(0, 0, 0, Qnil)) {
       case -1:
-	return INT2FIX(-1);
+	rb_sys_fail("daemon");
       case 0:
 	break;
       default:

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

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