File: 07_fix-ntp-servers.patch

package info (click to toggle)
system-tools-backends 2.10.2-5
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 3,412 kB
  • sloc: perl: 15,454; sh: 10,177; ansic: 824; makefile: 202
file content (29 lines) | stat: -rw-r--r-- 877 bytes parent folder | download | duplicates (3)
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
--- a/Time/NTP.pm
+++ b/Time/NTP.pm
@@ -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