Skip to content

Commit

Permalink
tzsetup: correct timezone symlink target
Browse files Browse the repository at this point in the history
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: 5e16809 ("tzsetup: symlink /etc/localtime instead of co...")
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D46725
  • Loading branch information
emaste committed Sep 30, 2024
1 parent 90cd9c2 commit 030c387
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions usr.sbin/tzsetup/tzsetup.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 030c387

Please sign in to comment.