CVSROOT: ciabot.pl - redirect all streams before forking

glen glen at pld-linux.org
Wed Jan 23 22:15:57 CET 2008


Author: glen                         Date: Wed Jan 23 21:15:57 2008 GMT
Module: CVSROOT                       Tag: HEAD
---- Log message:
- redirect all streams before forking

---- Files affected:
CVSROOT:
   ciabot.pl (1.19 -> 1.20) 

---- Diffs:

================================================================
Index: CVSROOT/ciabot.pl
diff -u CVSROOT/ciabot.pl:1.19 CVSROOT/ciabot.pl:1.20
--- CVSROOT/ciabot.pl:1.19	Wed Jan 23 22:13:11 2008
+++ CVSROOT/ciabot.pl	Wed Jan 23 22:15:52 2008
@@ -131,12 +131,11 @@
 sub daemonize {
   chdir '/'               or die "Can't chdir to /: $!";
   open STDIN, '/dev/null' or die "Can't read /dev/null: $!";
-  open STDOUT, '>/dev/null'
-    or die "Can't write to /dev/null: $!";
+  open STDOUT, '>/dev/null' or die "Can't write to /dev/null: $!";
+  open STDERR, '>&STDOUT' or die "Can't dup stdout: $!";
   defined(my $pid = fork) or die "Can't fork: $!";
   exit if $pid;
   setsid                  or die "Can't start a new session: $!";
-  open STDERR, '>&STDOUT' or die "Can't dup stdout: $!";
 }
 
 ### Input data loading
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/CVSROOT/ciabot.pl?r1=1.19&r2=1.20&f=u



More information about the pld-cvs-commit mailing list