mirror of
https://github.com/opnsense/src.git
synced 2026-06-18 13:10:00 -04:00
tzcode: Fix time zone change detection.
Prior to the 2022g import, tzloadbody() returned -1 on error. Now it
returns an errno code. When I updated the time zone change detection
logic to match, I improperly returned errno in all cases, which means
that if the time zone file has not changed since we last loaded it,
tzloadbody() returns a random errno value instead of 0.
Fixes: bc42155199
MFC after: 1 week
Sponsored by: Klara, Inc.
Sponsored by: NetApp, Inc.
Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D51405
This commit is contained in:
parent
655fcdde1a
commit
d63ffdd1ef
1 changed files with 5 additions and 9 deletions
|
|
@ -408,10 +408,8 @@ change_in_tz(const char *name)
|
|||
static char old_name[PATH_MAX];
|
||||
static struct stat old_sb;
|
||||
struct stat sb;
|
||||
int error;
|
||||
|
||||
error = stat(name, &sb);
|
||||
if (error != 0)
|
||||
if (stat(name, &sb) != 0)
|
||||
return -1;
|
||||
|
||||
if (strcmp(name, old_name) != 0) {
|
||||
|
|
@ -510,13 +508,11 @@ tzloadbody(char const *name, struct state *sp, bool doextend,
|
|||
* 'doextend' to ignore TZDEFRULES; the change_in_tz()
|
||||
* function can only keep state for a single file.
|
||||
*/
|
||||
int ret = change_in_tz(name);
|
||||
if (ret <= 0) {
|
||||
/*
|
||||
* Returns an errno value if there was an error,
|
||||
* and 0 if the timezone had not changed.
|
||||
*/
|
||||
switch (change_in_tz(name)) {
|
||||
case -1:
|
||||
return errno;
|
||||
case 0:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
fid = _open(name, O_RDONLY | O_BINARY);
|
||||
|
|
|
|||
Loading…
Reference in a new issue