Re: Building sharutils 4.13.4 with MinGW

Andreas Schwab <[email protected]>
Newsgroups gmane.comp.gnu.utils.bugs
Message-ID <[email protected]>
Eli Zaretskii <[email protected]> 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, [email protected]
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."
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.