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:
Jamie Cameron
2025-10-25 20:00:04 -07:00
parent 7f93d6ddd8
commit 37f1b52391

View File

@@ -21,10 +21,15 @@ return &password_file($config{'gshadow_file'}) ? 2 : 0;
sub open_last_command
{
my ($fh, $user, $max) = @_;
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)
# Parses a line of output from last into an array of