r74995 - in /branches/upstream/libproc-daemon-perl/current: Changes MANIFEST META.yml lib/Proc/Daemon.pm lib/Proc/Daemon.pod
periapt-guest at users.alioth.debian.org
periapt-guest at users.alioth.debian.org
Wed Jun 1 13:54:06 UTC 2011
Author: periapt-guest
Date: Wed Jun 1 13:53:48 2011
New Revision: 74995
URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=74995
Log:
[svn-upgrade] new version libproc-daemon-perl (0.13)
Modified:
branches/upstream/libproc-daemon-perl/current/Changes
branches/upstream/libproc-daemon-perl/current/MANIFEST
branches/upstream/libproc-daemon-perl/current/META.yml
branches/upstream/libproc-daemon-perl/current/lib/Proc/Daemon.pm
branches/upstream/libproc-daemon-perl/current/lib/Proc/Daemon.pod
Modified: branches/upstream/libproc-daemon-perl/current/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libproc-daemon-perl/current/Changes?rev=74995&op=diff
==============================================================================
--- branches/upstream/libproc-daemon-perl/current/Changes (original)
+++ branches/upstream/libproc-daemon-perl/current/Changes Wed Jun 1 13:53:48 2011
@@ -1,4 +1,10 @@
Revision history for Perl module Proc::Daemon.
+
+0.13 Wed Jun 01 2011
+ - Add ability to define the user identifier for the daemon if you want to
+ run it under other user then the parent (request from Holger Gläss).
+ - Add <eval> and <warn> for OS not supporting POSIX::setsid (e.g. Windows).
+ - Updated the documentation.
0.12 Tue Mai 24 2011
- Init() did not close all filehandles reliably in some cases. Thanks again
Modified: branches/upstream/libproc-daemon-perl/current/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libproc-daemon-perl/current/MANIFEST?rev=74995&op=diff
==============================================================================
--- branches/upstream/libproc-daemon-perl/current/MANIFEST (original)
+++ branches/upstream/libproc-daemon-perl/current/MANIFEST Wed Jun 1 13:53:48 2011
@@ -1,9 +1,9 @@
-Changes
-lib/Proc/Daemon.pm
-lib/Proc/Daemon.pod
-Makefile.PL
-MANIFEST
-README
-t/01_loadmodule.t
-t/02_testmodule.t
+Changes
+lib/Proc/Daemon.pm
+lib/Proc/Daemon.pod
+Makefile.PL
+MANIFEST
+README
+t/01_loadmodule.t
+t/02_testmodule.t
META.yml Module meta-data (added by MakeMaker)
Modified: branches/upstream/libproc-daemon-perl/current/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libproc-daemon-perl/current/META.yml?rev=74995&op=diff
==============================================================================
--- branches/upstream/libproc-daemon-perl/current/META.yml (original)
+++ branches/upstream/libproc-daemon-perl/current/META.yml Wed Jun 1 13:53:48 2011
@@ -1,6 +1,6 @@
--- #YAML:1.0
name: Proc-Daemon
-version: 0.12
+version: 0.13
abstract: ~
license: perl
author:
Modified: branches/upstream/libproc-daemon-perl/current/lib/Proc/Daemon.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libproc-daemon-perl/current/lib/Proc/Daemon.pm?rev=74995&op=diff
==============================================================================
--- branches/upstream/libproc-daemon-perl/current/lib/Proc/Daemon.pm (original)
+++ branches/upstream/libproc-daemon-perl/current/lib/Proc/Daemon.pm Wed Jun 1 13:53:48 2011
@@ -21,7 +21,7 @@
use strict;
use POSIX();
-$Proc::Daemon::VERSION = '0.12';
+$Proc::Daemon::VERSION = '0.13';
my %memory;
@@ -32,6 +32,7 @@
#
# %Daemon_Settings are hash key=>values and can be:
# work_dir => '/working/daemon/directory' -> defaults to '/'
+# setuid => 12345 -> defaults to <undef>
# child_STDIN => '/path/to/daemon/STDIN.file' -> defautls to '</dev/null'
# child_STDOUT => '/path/to/daemon/STDOUT.file' -> defaults to '+>/dev/null'
# child_STDERR => '/path/to/daemon/STDERR.file' -> defaults to '+>/dev/null'
@@ -153,9 +154,12 @@
# Clear the file creation mask.
umask 0;
- # Detach the child from the terminal (no controlling tty), make it the
- # session-leader and the process-group-leader of a new process group.
- die "Cannot detach from controlling terminal" if POSIX::setsid() < 0;
+ # Detach the child from the terminal (no controlling tty), make it
+ # the session-leader and the process-group-leader of a new process
+ # group. Some (Windows) OS do not support POSIX::setsid(). This is
+ # the reason for the <eval> here. In this case we only <warn>.
+ die "Cannot detach from controlling terminal" if ( eval{ POSIX::setsid() } || 0 ) < 0;
+ warn "Cannot detach from controlling terminal with POSIX::setsid(): $@" if $@;
# "Is ignoring SIGHUP necessary?
#
@@ -225,6 +229,10 @@
}
}
+ # Sets the real user identifier and the effective user
+ # identifier for the daemon process before opening files.
+ POSIX::setuid( $self->{setuid} ) if defined $self->{setuid};
+
# Reopen STDIN, STDOUT and STDERR to 'child_STD...'-path or to
# /dev/null. Data written on a null special file is discarded.
# Reads from the null special file always return end of file.
Modified: branches/upstream/libproc-daemon-perl/current/lib/Proc/Daemon.pod
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libproc-daemon-perl/current/lib/Proc/Daemon.pod?rev=74995&op=diff
==============================================================================
--- branches/upstream/libproc-daemon-perl/current/lib/Proc/Daemon.pod (original)
+++ branches/upstream/libproc-daemon-perl/current/lib/Proc/Daemon.pod Wed Jun 1 13:53:48 2011
@@ -67,7 +67,8 @@
=item 4
The child becomes a session leader, which detaches the program from the
-controlling terminal.
+controlling terminal. Windows OS mostly do not perform this action, Proc::Daemon
+will C<warn> you about this.
=item 5
@@ -136,6 +137,17 @@
Defines the path to the working directory of your daemon. Defaults to C</>.
+=item setuid
+
+Sets the real user identifier (C<< $< >>) and the effective user identifier
+(C<< $> >>) for the daemon process using C<POSIX::setuid( ... )>, in case you
+want to run your daemon under an other user then the parent. Obviously the
+first user must have the rights to switch to the new user otherwise it will
+stay the same. It is helpful to define the argument C<setuid> if you start your
+script at boot time by init with the superuser, but wants the daemon to run
+under a normal user account.
+
+
=item child_STDIN
Defines the path to STDIN for your daemon. Defaults to C</dev/null>. Default
@@ -183,8 +195,8 @@
=item pid_file
-Defines the path to a file where the PID of the daemon process will be
-stored. Defaults to C<undef> (= write no file).
+Defines the path to a file (owned by the parent user) where the PID of the
+daemon process will be stored. Defaults to C<undef> (= write no file).
=item exec_command
More information about the Pkg-perl-cvs-commits
mailing list