clock_gettime() returns 0 if it succeeds, so don't capture that into the
fail logic. With this, WITH_DETECT_TZ_CHANGES successfully detects a
change after 61 seconds.
Details
- Reviewers
allanjude trasz imp - Commits
- rGa2c51da6581d: tzcode: fix tz change detection logic
Diff Detail
- Repository
- rG FreeBSD src repository
- Lint
Lint Not Applicable - Unit
Tests Not Applicable
Event Timeline
I'm also wondering if we should drop this name check stuff in change_in_tz(). name == "/etc/localtime" and that's almost never going to change, we'd need to trace it down to the last symlink to get anything meaningful and at that point I'm not sure it's worth the expense over just the one stat() and relying on dev/ino/ctime/mtime.
not sure about /etc/timezone. I think this code was written to detect changes to that file specifically...
Thanks for tracking this down :-) As for change_in_tz() - I hadn't investigated the code around it to figure out if the path can actually change, but it kinda looks like it's trying to avoid making assumptions about it. Still, even if it did change, we would get a different inode/device numbers in stat info, which makes the name check redundant anyway.