Commit c81641ce authored by Leigh B Stoller's avatar Leigh B Stoller

Couple of tweaks to AuditAbort() and AuditDisconnect() to make sure

that the saved stdin/stderr are closed and gone.
parent c9e503a9
#!/usr/bin/perl -w
#
# Copyright (c) 2000-2016 University of Utah and the Flux Group.
# Copyright (c) 2000-2017 University of Utah and the Flux Group.
#
# {{{EMULAB-LICENSE
#
......@@ -308,16 +308,21 @@ sub AuditGetARGV()
return @SAVEARGV;
}
#
# Basically, we saying we are not going back.
#
sub AuditDisconnect()
{
if ($auditing) {
if (!$daemon && $libaudit::SAVE_STDOUT) {
open(FOO, "> /dev/null");
POSIX::close($libaudit::SAVE_STDOUT);
POSIX::close($libaudit::SAVE_STDERR);
open(FOO, "> /dev/null");
$libaudit::SAVE_STDOUT = fileno(FOO);
$libaudit::SAVE_STDERR = fileno(FOO);
$libaudit::SAVE_STDOUT = POSIX::dup(fileno(FOO));
$libaudit::SAVE_STDERR = POSIX::dup(fileno(FOO));
close(FOO);
}
}
}
......@@ -333,6 +338,10 @@ sub AuditAbort()
if (!$daemon && $libaudit::SAVE_STDOUT) {
POSIX::dup2($libaudit::SAVE_STDOUT, fileno(STDOUT));
POSIX::dup2($libaudit::SAVE_STDERR, fileno(STDERR));
POSIX::close($libaudit::SAVE_STDOUT);
POSIX::close($libaudit::SAVE_STDERR);
$libaudit::SAVE_STDOUT = 0;
$libaudit::SAVE_STDERR = 0;
}
if (defined($logfile)) {
......
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