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: 5e16809c95 ("tzsetup: symlink /etc/localtime instead of co...")
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D46725
This commit is contained in:
Ed Maste 2024-09-21 07:13:27 -04:00
parent 90cd9c203e
commit 030c387f5d

View File

@ -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);