marsadm: fix lamport warning when mars.ko is not loaded

This commit is contained in:
Thomas Schoebel-Theuer 2014-01-22 08:45:02 +01:00
parent 059abe866b
commit ab1723f306

View File

@ -179,12 +179,13 @@ sub get_alive_links {
# fallback to system time()
#
sub mars_time {
open(my $lamport_clock, "<", "/proc/sys/mars/lamport_clock");
my $lamport_time;
while (<$lamport_clock>) {
$lamport_time = $1 if /^lamport_now=(.*)/;
if (open(my $lamport_clock, "<", "/proc/sys/mars/lamport_clock")) {
while (<$lamport_clock>) {
$lamport_time = $1 if /^lamport_now=(.*)/;
}
close($lamport_clock);
}
close($lamport_clock);
return $lamport_time || time() . "." . '0' x 9;
}