Commit af07934d authored by Salvatore Bonaccorso's avatar Salvatore Bonaccorso

[svn-upgrade] Integrating new upstream version, libapp-daemon-perl (0.08)

parent af433bf2
Revision history for Perl extension App::Daemon.
0.08 (10/08/2009)
(ms) [RT 50326] Fixed insecure dependency error in tainted mode
by untainting the string obtained by appname().
0.07 (03/24/2009)
0.08 (11/05/2009)
(ms) [RT 50884] Applied patch by Matthew Byng-Maddick allow overriding
app-internal option settings by command line options. Order is now:
command line > app-internal > App::Daemon internal
(ms) [RT 51066] Applied patch by Mike Whitaker to point stdin/out/err
to /dev/null instead of closing them.
0.07 (10/08/2009)
(ms) Applied patch by Sadrak [rt:44513] to check if Log4perl has
already been initialized and skip the easy_init call in this
case. Note that -v then has to be handled by the user-provided
Log4perl configuration instead.
(ms) [RT 50326] Fixed insecure dependency error in tainted mode
by untainting the string obtained by appname().
0.06 (03/05/2009)
(ms) Added detach() as an importable method for simple daemons.
......
......@@ -2,7 +2,7 @@ package App::Daemon;
use strict;
use warnings;
our $VERSION = '0.07';
our $VERSION = '0.08';
use Getopt::Std;
use Pod::Usage;
......@@ -30,20 +30,29 @@ sub cmd_line_parse {
pod2usage();
}
if(!defined $pidfile) {
$pidfile = find_option('-p', 1) || ( '/tmp/' . $appname . ".pid" );
if(my $_pidfile = find_option('-p', 1)) {
$pidfile = $_pidfile;
}
else {
$pidfile ||= ( '/tmp/' . $appname . ".pid" );
}
if(!defined $logfile) {
$logfile = find_option('-l', 1) || ( '/tmp/' . $appname . ".log" );
if(my $_logfile = find_option('-l', 1)) {
$logfile = $_logfile;
}
else {
$logfile ||= ( '/tmp/' . $appname . ".log" );
}
if(!defined $l4p_conf) {
$l4p_conf = find_option('-l4p', 1);
if(my $_l4p_conf = find_option('-l4p', 1)) {
$l4p_conf = $_l4p_conf;
}
if(!defined $as_user) {
$as_user = find_option('-u', 1) || "nobody";
if(my $_as_user = find_option('-u', 1)) {
$as_user = $_as_user;
}
else {
$as_user ||= 'nobody';
}
if($> != 0) {
......@@ -51,14 +60,12 @@ sub cmd_line_parse {
($as_user) = getpwuid($>);
}
if(!defined $background) {
$background = find_option('-X') ? 0 : 1,
}
$background = 1 if(!defined $background);
$background = find_option('-X') ? 0 : $background;
if(!defined $loglevel) {
$loglevel = find_option('-v') ? $DEBUG : $INFO;
$loglevel = $DEBUG if !$background;
}
$loglevel = $background ? $INFO : $DEBUG
if(!defined $loglevel);
$loglevel = find_option('-v') ? $DEBUG : $loglevel;
for (qw(start stop status)) {
if( find_option( $_ ) ) {
......@@ -184,9 +191,19 @@ sub detach {
}
# close std file descriptors
close(STDIN);
close(STDOUT);
close(STDERR);
if(-e "/dev/null") {
# On Unix, we want to point these file descriptors at /dev/null,
# so that any libary routines that try to read form stdin or
# write to stdout/err will have no effect (Stevens, APitUE, p. 426
# and [RT 51066].
open STDIN, '/dev/null';
open STDOUT, '>>/dev/null';
open STDERR, '>>/dev/null';
} else {
close(STDIN);
close(STDOUT);
close(STDERR);
}
}
###########################################
......
--- #YAML:1.0
name: App-Daemon
version: 0.07
version: 0.08
abstract: Start an Application as a Daemon
author:
- Mike Schilli <m@perlmeister.com>
......
######################################################################
App::Daemon 0.07
App::Daemon 0.08
######################################################################
NAME
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment