[X2Go-Commits] [x2goserver] 01/01: x2gocleansessions: Redirect stdin, stdout and stderr to /dev/null, test for the existence of the file descriptor before issuing the close, only capture the file descriptor backreference in the regex and send any close failures to syslog. (Fixes: #678).
git-admin at x2go.org
git-admin at x2go.org
Sat Nov 22 15:25:03 CET 2014
This is an automated email from the git hooks/post-receive script.
x2go pushed a commit to branch release/4.0.1.x
in repository x2goserver.
commit 93bcf8568a2b347bcc1e142e4315c9ba455c7e6f
Author: Matthew L. Dailey <matthew.l.dailey at dartmouth.edu>
Date: Sat Nov 22 15:24:16 2014 +0100
x2gocleansessions: Redirect stdin, stdout and stderr to /dev/null, test for the existence of the file descriptor before issuing the close, only capture the file descriptor backreference in the regex and send any close failures to syslog. (Fixes: #678).
---
debian/changelog | 7 +++++++
x2goserver/sbin/x2gocleansessions | 24 +++++++++++-------------
2 files changed, 18 insertions(+), 13 deletions(-)
diff --git a/debian/changelog b/debian/changelog
index c0e4300..31a351e 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -79,6 +79,13 @@ x2goserver (4.0.1.19-0x2go1) UNRELEASED; urgency=medium
"x2gouser".
+ Add to BR: findutils.
+ [ Matthew L. Dailey ]
+ * New upstream version (4.0.1.19):
+ - x2gocleansessions: Redirect stdin, stdout and stderr to /dev/null, test
+ for the existence of the file descriptor before issuing the close,
+ only capture the file descriptor backreference in the regex and
+ send any close failures to syslog. (Fixes: #678).
+
-- Mike Gabriel <mike.gabriel at das-netzwerkteam.de> Tue, 07 Oct 2014 15:35:38 +0200
x2goserver (4.0.1.18-0x2go1) unstable; urgency=medium
diff --git a/x2goserver/sbin/x2gocleansessions b/x2goserver/sbin/x2gocleansessions
index db38e1e..94f6294 100755
--- a/x2goserver/sbin/x2gocleansessions
+++ b/x2goserver/sbin/x2gocleansessions
@@ -139,23 +139,21 @@ elsif ($pid == 0 )
# close any open file descriptor left open by our parent before the fork
my $fd;
for (glob "/proc/$$/fd/*") {
- if ($_ =~ m/\/proc\/(\d+)\/fd\/(\d+)/) {
- $fd = $2;
- if ( $fd == 0 ) { next; }
- if ( $fd == 1 ) { next; }
- if (POSIX::close($fd)) {
- print "";
- #print "Closed:II$_\n";
- } else {
- print "";
- #print "Error Closing:I$_\n";
+ if ( ! -e $_ ) { next; }
+ if ($_ =~ m/\/proc\/\d+\/fd\/(\d+)/) {
+ $fd = $1;
+ if ( $fd < 3 ) { next; }
+ if (! POSIX::close($fd)) {
+ syslog('warning', "Error Closing $_: $!");
}
- } else {
- print "";
- #print "ERROR: $_\n";
}
}
+ # redirect stdin, stdout and stderr
+ open *STDIN, q{<}, '/dev/null';
+ open *STDOUT, q{>>}, '/dev/null';
+ open *STDERR, q{>>}, '/dev/null';
+
$SIG{TERM}=\&catch_term;
$SIG{CHLD} = sub { wait };
--
Alioth's /srv/git/_hooks_/post-receive-email on /srv/git/code.x2go.org/x2goserver.git
More information about the x2go-commits
mailing list