1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
|
Author: Christophe Masson <chrs.masson@free.fr>
Description: In the function apply_ntp_date, from the module NTP, a misuse of
variables prevents the list of servers from being initialized correctly
when the the parameter @config is empty.
diff --git a/Time/NTP.pm b/Time/NTP.pm
index 026ba3e..f2184a2 100644
@@ -149,15 +149,13 @@ sub set_ntp_servers
sub apply_ntp_date
{
my ($config) = @_;
- my ($servers, $server);
+ my $servers;
- foreach $server (@$config) {
- $servers .= " $server";
- }
+ $servers = join " ", @$config;
- if ($server eq "") {
+ if ($servers eq "") {
# There are no servers, pick them from the ntp.org pool
- $server = "0.pool.ntp.org 1.pool.ntp.org 2.pool.ntp.org";
+ $servers = "0.pool.ntp.org 1.pool.ntp.org 2.pool.ntp.org";
}
# run ntpdate, this will only be effective
|