The branch, build-main has been updated via b03665513ab1969b069c1351fe17cbb8b5fca256 (commit) from ebbb6a0b17264a6d9743ab8a7199fb964ba20efd (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 b03665513ab1969b069c1351fe17cbb8b5fca256 Author: Mike Gabriel <mike.gabriel@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 fa1f121..fd4f452 100644 --- a/debian/changelog +++ b/debian/changelog @@ -173,6 +173,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@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).