mirror of
https://github.com/webmin/webmin.git
synced 2026-02-03 06:03:28 +00:00
Don't try to run the last command if it's not installed
https://github.com/webmin/webmin/discussions/2161
This commit is contained in:
@@ -21,9 +21,14 @@ return &password_file($config{'gshadow_file'}) ? 2 : 0;
|
||||
sub open_last_command
|
||||
{
|
||||
my ($fh, $user, $max) = @_;
|
||||
my $quser = quotemeta($user);
|
||||
$max = " -n $max" if ($max);
|
||||
open($fh, "(last -F -w$max $quser || last -w$max $quser) |");
|
||||
if (&has_command("last")) {
|
||||
my $quser = quotemeta($user);
|
||||
$max = " -n $max" if ($max);
|
||||
open($fh, "(last -F -w$max $quser || last -w$max $quser) |");
|
||||
}
|
||||
else {
|
||||
open($fh, "</dev/null");
|
||||
}
|
||||
}
|
||||
|
||||
# read_last_line(handle)
|
||||
|
||||
Reference in New Issue
Block a user