[X2Go-Commits] [x2goserver] 01/01: now really fix the file descriptor closures

git-admin at x2go.org git-admin at x2go.org
Sat Mar 8 22:58:39 CET 2014


This is an automated email from the git hooks/post-receive script.

x2go pushed a commit to branch master
in repository x2goserver.

commit a322d8c7a4bd0e6d5a4dce09bbb076275516740b
Author: Mike Gabriel <mike.gabriel at das-netzwerkteam.de>
Date:   Sat Mar 8 22:58:14 2014 +0100

    now really fix the file descriptor closures
---
 x2goserver/sbin/x2gocleansessions |   20 +++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)

diff --git a/x2goserver/sbin/x2gocleansessions b/x2goserver/sbin/x2gocleansessions
index cff334f..45db2cb 100755
--- a/x2goserver/sbin/x2gocleansessions
+++ b/x2goserver/sbin/x2gocleansessions
@@ -26,6 +26,7 @@ $ENV{'PATH'} = "/bin:/sbin:/usr/bin:/usr/sbin";
 
 use Sys::Hostname;
 use Sys::Syslog qw( :standard :macros );
+use POSIX;
 
 use File::ReadBackwards;
 
@@ -93,7 +94,24 @@ elsif ($pid == 0 )
 	my $superenice_ignoredusers=$Config->param("superenicer.ignored-users");
 
 	# close any open file descriptor left open by our parent before the fork
-	for (glob "/proc/$$/fd/*") { POSIX::close($_) if m{/(\d+)$}; }
+	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";
+			}
+		} else {
+			print "";
+			#print "ERROR: $_\n";
+		}
+	}
 
 	$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