From 030c387f5d74a66d0d5950e3450d6da24237fb2e Mon Sep 17 00:00:00 2001 From: Ed Maste Date: Sat, 21 Sep 2024 07:13:27 -0400 Subject: [PATCH] tzsetup: correct timezone symlink target In chroot mode tzsetup prepended the chroot path to the symlink target, which is not correct. Use the same path for the symlink regardless of chroot mode. PR: 281332 Reported by: scf, Herbert J. Skuhra Reviewed by: olce Fixes: 5e16809c953f ("tzsetup: symlink /etc/localtime instead of co...") Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D46725 --- usr.sbin/tzsetup/tzsetup.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/usr.sbin/tzsetup/tzsetup.c b/usr.sbin/tzsetup/tzsetup.c index 617de4efb76..914eeb145a0 100644 --- a/usr.sbin/tzsetup/tzsetup.c +++ b/usr.sbin/tzsetup/tzsetup.c @@ -877,19 +877,19 @@ main(int argc, char **argv) else strlcpy(path_zonetab, dztpath, sizeof(path_zonetab)); strcpy(path_iso3166, _PATH_ISO3166); - strcpy(path_zoneinfo, _PATH_ZONEINFO); strcpy(path_localtime, _PATH_LOCALTIME); strcpy(path_db, _PATH_DB); strcpy(path_wall_cmos_clock, _PATH_WALL_CMOS_CLOCK); } else { sprintf(path_zonetab, "%s/%s", chrootenv, _PATH_ZONETAB); sprintf(path_iso3166, "%s/%s", chrootenv, _PATH_ISO3166); - sprintf(path_zoneinfo, "%s/%s", chrootenv, _PATH_ZONEINFO); sprintf(path_localtime, "%s/%s", chrootenv, _PATH_LOCALTIME); sprintf(path_db, "%s/%s", chrootenv, _PATH_DB); sprintf(path_wall_cmos_clock, "%s/%s", chrootenv, _PATH_WALL_CMOS_CLOCK); } + /* Symlink target is the same regardless of chroot */ + strcpy(path_zoneinfo, _PATH_ZONEINFO); /* Override the user-supplied umask. */ (void)umask(S_IWGRP | S_IWOTH);