[X2Go-Commits] x2goserver.git - release/4.0.0.x (branch) updated: 4.0.0.7-6-g4ba2a10

X2Go dev team git-admin at x2go.org
Fri Jan 3 18:00:37 CET 2014


The branch, release/4.0.0.x has been updated
       via  4ba2a108d228f22abdc3f5a20d3d602a4076197e (commit)
      from  80ff6997550749a64dd5db5684acbd47a4127ab3 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 4ba2a108d228f22abdc3f5a20d3d602a4076197e
Author: Mike Gabriel <mike.gabriel at das-netzwerkteam.de>
Date:   Sun Dec 29 14:19:15 2013 +0100

    Avoid one argument system calls and backticks in x2golistsessions.
    
    Conflicts (resolved by Mike Gabriel):
    	debian/changelog
    	x2goserver/bin/x2golistsessions

-----------------------------------------------------------------------

Summary of changes:
 debian/changelog                |    1 +
 x2goserver/bin/x2golistsessions |   27 +++++++++++++++++++--------
 2 files changed, 20 insertions(+), 8 deletions(-)

The diff of changes is:
diff --git a/debian/changelog b/debian/changelog
index c48b5c1..2769379 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -9,6 +9,7 @@ x2goserver (4.0.0.8-0x2go1) UNRELEASED; urgency=low
       for finding this!!! (Fixes: #356).
     - Avoid one argument system calls and backticks in x2gocleansessions and
       x2golistsessions_root.
+    - Avoid one argument system calls and backticks in x2golistsessions.
 
  -- Mike Gabriel <mike.gabriel at das-netzwerkteam.de>  Thu, 28 Nov 2013 16:14:32 +0100
 
diff --git a/x2goserver/bin/x2golistsessions b/x2goserver/bin/x2golistsessions
index eb24196..1b3d350 100755
--- a/x2goserver/bin/x2golistsessions
+++ b/x2goserver/bin/x2golistsessions
@@ -24,10 +24,13 @@ use strict;
 use Sys::Hostname;
 use Sys::Syslog qw( :standard :macros );
 
+use File::ReadBackwards;
+
 use lib `x2gopath lib`;
 use x2godbwrapper; 
 use x2gologlevel;
 
+
 openlog($0,'cons,pid','user');
 setlogmask( LOG_UPTO(x2gologlevel()) );
 
@@ -38,18 +41,26 @@ if ( @ARGV ) {
 	syslog('debug', "x2golistsessions has been called with no option");
 }
 
-sub check_stat
+
+sub is_suspended
 {
 	my $sess=shift;
-	my $log="$ENV{'HOME'}/.x2go/C-$sess/session.log";
-	my $text=`tail -1 $log 2>/dev/null`;
-	if ($text =~ m/Session suspended/)
+	my $log="$ENV{'HOME'}/.x2go/C-${sess}.log";
+	my $log_line;
+	my $log_file = File::ReadBackwards->new( $log ) or return 0;
+	while( defined( $log_line = $log_file->readline ) ) {
+		next if ( ! ( $log_line =~ m/^Session:/ ) );
+		last;
+	}
+	$log_file->close();
+	if ($log_line =~ m/Session suspended/)
 	{
-		return 0;
+		return 1;
 	}
-	return 1;
+	return 0;
 }
 
+
 my $serv=shift;
 if( ! $serv)
 {
@@ -79,11 +90,11 @@ for (my $i=0;$i<@outp;$i++)
 	{ 
 		if (@sinfo[4]eq 'R')
 		{
-			if(!check_stat(@sinfo[1]))
+			if(is_suspended(@sinfo[1]))
 			{
 				db_changestatus( 'S', @sinfo[1] );
 				@outp[$i] =~ s/\|R\|/\|S\|/;
-				system( "x2goumount-session @sinfo[1]");
+				system("x2goumount-session", "@sinfo[1]");
 			}
 		}
 		print "@outp[$i]\n";


hooks/post-receive
-- 
x2goserver.git (X2Go Server)

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "x2goserver.git" (X2Go Server).




More information about the x2go-commits mailing list