Commit ce5037a7 authored by Leigh B Stoller's avatar Leigh B Stoller
Browse files

Minor cleanup, reset a couple of global variables back to default state

when invoked (as for long running fcgid daemon).
parent 9ccc7333
......@@ -57,6 +57,7 @@ my $USERNAME = "Unknown";
my $GCOS = "Unknown";
my @SAVEARGV = @ARGV;
my $SAVEPID = $PID;
my $PREFORKFILE = "/var/tmp/auditfork_$PID";
my $SAVE_STDOUT = 0;
my $SAVE_STDERR = 0;
......@@ -148,6 +149,15 @@ sub AuditStart($;$$)
return;
}
# Reset to default for rentry in log running script.
$logfile = undef;
$prefork = undef;
$logonly = 0;
$logtblogs = 0;
$savelog = 0;
$fancy = 0;
$forked = 0;
# Logging instead of "auditing" ...
if (defined($options)) {
if ($options & LIBAUDIT_NODELETE()) {
......@@ -186,6 +196,9 @@ sub AuditStart($;$$)
$ENV{'TBAUDITON'} = "$SCRIPTNAME:$USERNAME";
return;
}
# Clear this in case left behind, as for long running process.
unlink($PREFORKFILE)
if (-e $PREFORKFILE);
if (!defined($logname)) {
$logfile = TBMakeLogname("$SCRIPTNAME");
......@@ -355,8 +368,11 @@ sub AuditAbort()
}
delete @ENV{'TBAUDITLOG', 'TBAUDITON'};
system("/usr/bin/touch $prefork")
if (defined($prefork));
if (defined($prefork)) {
my $oldmask = umask(0000);
system("/usr/bin/touch $prefork");
umask($oldmask);
}
}
return 0;
}
......@@ -372,7 +388,7 @@ sub AuditPrefork()
return 0
if (!$auditing);
$prefork = "/var/tmp/auditfork_$PID";
$prefork = $PREFORKFILE;
}
#
......
Supports Markdown
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