From e3e7f107c14b4c38f1374d45f811614b2fd777dd Mon Sep 17 00:00:00 2001 From: espie Date: Tue, 4 Jul 2023 14:41:26 +0000 Subject: [PATCH] use local assignment to $ENV{TZ} like we do for signal handlers --- usr.sbin/pkg_add/OpenBSD/PackingElement.pm | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/usr.sbin/pkg_add/OpenBSD/PackingElement.pm b/usr.sbin/pkg_add/OpenBSD/PackingElement.pm index d9d4d29ae35..8e0481f65f7 100644 --- a/usr.sbin/pkg_add/OpenBSD/PackingElement.pm +++ b/usr.sbin/pkg_add/OpenBSD/PackingElement.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: PackingElement.pm,v 1.288 2023/07/04 13:58:01 espie Exp $ +# $OpenBSD: PackingElement.pm,v 1.289 2023/07/04 14:41:26 espie Exp $ # # Copyright (c) 2003-2014 Marc Espie # @@ -1952,14 +1952,8 @@ sub _iso8601_to_time($s) my ($year, $month, $day, $hour, $min, $sec) = ($1 - 1900, $2-1, $3, $4, $5, $6); require POSIX; - my $oldtz = $ENV{TZ}; - $ENV{TZ} = 'UTC'; + local $ENV{TZ} = 'UTC'; my $t = POSIX::mktime($sec, $min, $hour, $day, $month, $year); - if (defined $oldtz) { - $ENV{TZ} = $oldtz; - } else { - delete $ENV{TZ}; - } return $t; } else { die "Incorrect ISO8601 timestamp: $s"; -- 2.20.1