diff options
author | Marc Espie <espie@cvs.openbsd.org> | 2023-07-04 14:41:27 +0000 |
---|---|---|
committer | Marc Espie <espie@cvs.openbsd.org> | 2023-07-04 14:41:27 +0000 |
commit | 265b1f3c91ce1adb4e640e359f5ab12ac898c3d6 (patch) | |
tree | 4e5a5a4c3651563796d1b95343d41938124fea7a /usr.sbin/pkg_add | |
parent | dcafc79fb67d4a829b4e08272835144eb99516f9 (diff) |
use local assignment to $ENV{TZ} like we do for signal handlers
Diffstat (limited to 'usr.sbin/pkg_add')
-rw-r--r-- | usr.sbin/pkg_add/OpenBSD/PackingElement.pm | 10 |
1 files 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 <espie@openbsd.org> # @@ -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"; |