diff options
author | Alex Musolino <alex@musolino.id.au> | 2020-12-15 20:55:41 +1030 |
---|---|---|
committer | Alex Musolino <alex@musolino.id.au> | 2020-12-15 20:55:41 +1030 |
commit | 3749e92cdb88a157f99c0709a264bd508603be9b (patch) | |
tree | 49ce703965ba4114490729c5aeabd9ba120d9b78 /sys/src/libc/port/date.c | |
parent | 404c901f299c4d93cb159a3c44c2977a25408319 (diff) | |
parent | 32291b52bcbd6976051acff1692b571e321ac859 (diff) |
merge
Diffstat (limited to 'sys/src/libc/port/date.c')
-rw-r--r-- | sys/src/libc/port/date.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/sys/src/libc/port/date.c b/sys/src/libc/port/date.c index 7be6cb52f..805302432 100644 --- a/sys/src/libc/port/date.c +++ b/sys/src/libc/port/date.c @@ -174,11 +174,12 @@ loadzone(Tzone *tz, char *name) else snprint(path, sizeof(path), "/adm/timezone/%s", name); memset(buf, 0, sizeof(buf)); - if((f = open(path, 0)) == -1) + f = open(path, OREAD|OCEXEC); + if(f < 0) return -1; r = read(f, buf, sizeof(buf)); close(f); - if(r == sizeof(buf) || r == -1) + if(r < 0 || r >= sizeof(buf)) return -1; buf[r] = 0; p = buf; |