]> git.lizzy.rs Git - plan9front.git/commitdiff
upas/fs: fix handling of numeric timezone offsets in strtotm
authorAlex Musolino <alex@musolino.id.au>
Wed, 30 Oct 2019 23:11:03 +0000 (09:41 +1030)
committerAlex Musolino <alex@musolino.id.au>
Wed, 30 Oct 2019 23:11:03 +0000 (09:41 +1030)
Since numeric timezone offsets are relative to GMT, initialise zone to
GMT so tm2sec(2) does not assume local time.

Note that if strtotm encounters a timezone *string* and consequently
overwrites zone then we will end up in the same mess since tm2sec(2)
only deals with GMT or local time.

sys/src/cmd/upas/fs/strtotm.c

index ccdc7c16c46fb35119ada9e937d6d1b5e9918ad4..fc6510f1a57d688df7f819820dd9b8e55df5d12b 100644 (file)
@@ -38,6 +38,7 @@ strtotm(char *p, Tm *t)
        tm.min = -1;
        tm.year = -1;
        tm.mday = -1;
+       memcpy(tm.zone, "GMT", 3);
        for(p = skipwhite(p); *p; p = skipwhite(q)){
                q = skiptext(p);