[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Building sharutils 4.13.4 with MinGW
From: |
Andreas Schwab |
Subject: |
Re: Building sharutils 4.13.4 with MinGW |
Date: |
Sun, 07 Apr 2013 19:48:21 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) |
Eli Zaretskii <address@hidden> writes:
> 6. shar fails to record the time and the submitter of the archive:
>
> # Made on by <>.
>
> The time was missing because print_header_stamp assumed %Z format
> in strftime always takes at most 4 characters:
>
> static char const ftime_fmt[] = "%Y-%m-%d %H:%M %Z";
> /*
> * All fields are two characters, except %Y is four.
> */
> char buffer[sizeof (ftime_fmt) + 4]; <<<<<<<<<<<<<<<
> time_t now;
> struct tm * local_time;
> time (&now);
> local_time = localtime (&now);
> strftime (buffer, sizeof (buffer) - 1, ftime_fmt, local_time);
>
> which is false on Windows;
It is even wrong for Unix, where timezone names can have as much as
TZNAME_MAX (typically 6) characters, and a couple of current zones in
the Olsen database have more than 4 characters, let alone a lot of
historical ones.
Andreas.
--
Andreas Schwab, address@hidden
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."