mirror of
https://git.proxmox.com/git/pve-common
synced 2025-07-25 10:53:37 +00:00
follouwp: improve comment detection and refactor slightly
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
parent
e76308e6eb
commit
36b9c07397
@ -486,19 +486,19 @@ register_format('timezone', \&pve_verify_timezone);
|
||||
sub pve_verify_timezone {
|
||||
my ($timezone, $noerr) = @_;
|
||||
|
||||
my $zonetab = "/usr/share/zoneinfo/zone.tab";
|
||||
return $timezone if $timezone eq 'UTC';
|
||||
open(my $fh, "<", $zonetab);
|
||||
while(my $line = <$fh>) {
|
||||
next if $line =~ /^#/;
|
||||
|
||||
open(my $fh, "<", "/usr/share/zoneinfo/zone.tab");
|
||||
while (my $line = <$fh>) {
|
||||
next if $line =~ /^\s*#/;
|
||||
chomp $line;
|
||||
return $timezone if $timezone eq (split /\t/, $line)[2]; # found
|
||||
my $zone = (split /\t/, $line)[2];
|
||||
return $timezone if $timezone eq $zone; # found
|
||||
}
|
||||
close $fh;
|
||||
|
||||
return undef if $noerr;
|
||||
die "invalid time zone '$timezone'\n";
|
||||
|
||||
}
|
||||
|
||||
# network interface name
|
||||
|
Loading…
Reference in New Issue
Block a user