Re: [PATCH] add tests for tzset(3)

jdoubleu <[email protected]>
Newsgroups gmane.comp.lib.newlib
Message-ID <[email protected]>
Hi Jeff,

I finally found some time to have a look at your patch.
>       if (sscanf (tzenv, "%10[-+0-9A-Za-z]%n", __tzname_std, &n) <= 0
> 		|| n < TZNAME_MIN || TZNAME_MAX < n || '>' != tzenv[n])

> +      else if (n < TZNAME_MIN || TZNAME_MAX < n)

I think the sub-expression "TZNAME_MAX < n" can never be true, can it? 
sscanf will always stop after 10 characters.

What do you think about including the TZNAME_MAX macro inside the format 
string?

> #define STR(s) #s
> #define STR_LIT(s) STR(s)
> ...
> sscanf(tzenv, "%" STR_LIT(TZNAME_MAX) "[-+0-9A-Za-z]%n", __tzname_dst, &n)

I'll try to update the tests in the coming days, so I can verify your 
changes work as expected.


Cheers
---
🙎🏻‍♂️ jdoubleu
On 4/29/2022 5:46 PM, Jeff Johnston wrote:
> I have revised my tzset_r.c patch so that the tzrules are initialized so we
> don't inherit the previous settings if not specified for a particular TZ.
> As well, I defaulted them if TZ is not specified.
> 
> -- Jeff J.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.