git: 202b59c35ead - main - tzcode: Really fix issues when TZ is an absolute path
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sun, 28 Sep 2025 11:12:55 UTC
The branch main has been updated by des:
URL: https://cgit.FreeBSD.org/src/commit/?id=202b59c35ead5bd2b71331169bdeb4845cb655c1
commit 202b59c35ead5bd2b71331169bdeb4845cb655c1
Author: Dag-Erling Smørgrav <des@FreeBSD.org>
AuthorDate: 2025-09-28 11:11:26 +0000
Commit: Dag-Erling Smørgrav <des@FreeBSD.org>
CommitDate: 2025-09-28 11:12:44 +0000
tzcode: Really fix issues when TZ is an absolute path
This was accidentally left out of the previous commit.
Fixes: df8bc705eb04 ("tzcode: Fix issues when TZ is an absolute path")
---
contrib/tzcode/localtime.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/contrib/tzcode/localtime.c b/contrib/tzcode/localtime.c
index c98134f7be7c..8638ac9ba2cd 100644
--- a/contrib/tzcode/localtime.c
+++ b/contrib/tzcode/localtime.c
@@ -672,13 +672,16 @@ tzloadbody(char const *name, struct state *sp, char tzloadflags,
if ((tzloadflags & TZLOAD_FROMENV) && strcmp(name, TZDEFAULT) == 0)
tzloadflags &= ~TZLOAD_FROMENV;
relname = name;
- if (strncmp(relname, TZDIR "/", strlen(TZDIR) + 1) == 0)
+ if (strncmp(relname, TZDIR "/", strlen(TZDIR) + 1) == 0) {
relname += strlen(TZDIR) + 1;
+ while (*relname == '/')
+ relname++;
+ }
dd = open(TZDIR, O_DIRECTORY | O_RDONLY);
if ((tzloadflags & TZLOAD_FROMENV) && issetugid()) {
if (dd < 0)
return errno;
- if (fstatat(dd, name, &sb, AT_RESOLVE_BENEATH) < 0) {
+ if (fstatat(dd, relname, &sb, AT_RESOLVE_BENEATH) < 0) {
fid = -1;
} else if (!S_ISREG(sb.st_mode)) {
fid = -1;