[File] [PATCH] print.c: initialize timezone data for localtime_r()

Christos Zoulas christos at zoulas.com
Thu Sep 14 13:20:32 UTC 2023


Added, thanks!

christos

> On Aug 7, 2023, at 7:07 PM, <joe.slater at windriver.com> <joe.slater at windriver.com> wrote:
> 
> From: Joe Slater <joe.slater at windriver.com>
> 
> The man page for localtime() points out that while it acts
> like tzset() has been called, localtime_r() might not.  We
> have a local version of localtime_r() that avoids this, but
> we do not compile it.
> 
> Signed-off-by: Joe Slater <joe.slater at windriver.com>
> ---
> src/print.c | 1 +
> 1 file changed, 1 insertion(+)
> 
> diff --git a/src/print.c b/src/print.c
> index 18f42a05..b1de4908 100644
> --- a/src/print.c
> +++ b/src/print.c
> @@ -286,6 +286,7 @@ file_fmtdatetime(char *buf, size_t bsize, uint64_t v, int flags)
> 	}
> 
> 	if (flags & FILE_T_LOCAL) {
> +		tzset();
> 		tm = localtime_r(&t, &tmz);
> 	} else {
> 		tm = gmtime_r(&t, &tmz);
> --
> 2.35.5
> 
> --
> File mailing list
> File at astron.com
> https://mailman.astron.com/mailman/listinfo/file

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 235 bytes
Desc: Message signed with OpenPGP
URL: <https://mailman.astron.com/pipermail/file/attachments/20230914/4e4b3749/attachment.asc>


More information about the File mailing list