mirror of
https://git.proxmox.com/git/pve-common
synced 2025-07-26 05:32:08 +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 {
|
sub pve_verify_timezone {
|
||||||
my ($timezone, $noerr) = @_;
|
my ($timezone, $noerr) = @_;
|
||||||
|
|
||||||
my $zonetab = "/usr/share/zoneinfo/zone.tab";
|
|
||||||
return $timezone if $timezone eq 'UTC';
|
return $timezone if $timezone eq 'UTC';
|
||||||
open(my $fh, "<", $zonetab);
|
|
||||||
while(my $line = <$fh>) {
|
open(my $fh, "<", "/usr/share/zoneinfo/zone.tab");
|
||||||
next if $line =~ /^#/;
|
while (my $line = <$fh>) {
|
||||||
|
next if $line =~ /^\s*#/;
|
||||||
chomp $line;
|
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;
|
close $fh;
|
||||||
|
|
||||||
return undef if $noerr;
|
return undef if $noerr;
|
||||||
die "invalid time zone '$timezone'\n";
|
die "invalid time zone '$timezone'\n";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# network interface name
|
# network interface name
|
||||||
|
Loading…
Reference in New Issue
Block a user