From b4c9d299712dfa9f3d4afed2196283e0a0ba2310 Mon Sep 17 00:00:00 2001 From: Stefan Schantl Date: Mon, 15 Nov 2021 21:23:33 +0100 Subject: [PATCH] pakfire.cgi: Bring back old logic for log displaying Trying to get rid of the system backpipe check if a pakfire is running does not work very well. It simply makes the code more complex and only introduced some new problems. This commit switches back to the old logic which worked well in the past. Signed-off-by: Stefan Schantl Reviewed-by: Bernhard Bitsch Tested-by: Bernhard Bitsch --- html/cgi-bin/pakfire.cgi | 57 +++++++--------------------------------- 1 file changed, 10 insertions(+), 47 deletions(-) diff --git a/html/cgi-bin/pakfire.cgi b/html/cgi-bin/pakfire.cgi index f2381f0312..4d6eee284c 100644 --- a/html/cgi-bin/pakfire.cgi +++ b/html/cgi-bin/pakfire.cgi @@ -44,8 +44,6 @@ $cgiparams{'VALID'} = ''; $cgiparams{'INSPAKS'} = ''; $cgiparams{'DELPAKS'} = ''; -my $page_lock; - sub refreshpage{&Header::openbox( 'Waiting', 1, "" );print "

$Lang::tr{'pagerefresh'}
";&Header::closebox();} &Header::getcgihash(\%cgiparams); @@ -59,9 +57,8 @@ sub refreshpage{&Header::openbox( 'Waiting', 1, " - - - $Lang::tr{ - - - - $Lang::tr{'pakfire working'} - - - -END - &Header::closebox(); - - # Infinite loop to lock the page until pakfire lockfile is present. - while($page_lock) { - unless (-e $Pakfire::lockfile) { - sleep(1); - } else { - # Release page lock. - undef($page_lock); - - # Break loop. - last; - } - } - - # Perform page reload. - print "\n"; - exit; -} +# Check if pakfire is already running. +# +# The system backpipe command is safe, because no user input is computed. +my $pid = `pidof pakfire`; -# Check if pakfire is already running. In this case a lockfile is present. -if (-e $Pakfire::lockfile) { +if ($pid) { &Header::openbox( 'Waiting', 1, "" ); print < -- 2.39.5