[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: another fix for an unlikely core dump in 'who' and 'pinky'
From: |
Jim Meyering |
Subject: |
Re: another fix for an unlikely core dump in 'who' and 'pinky' |
Date: |
Tue, 22 Jun 2004 17:05:18 +0200 |
Paul Eggert <address@hidden> wrote:
> It turns out that my previous fix wasn't enough in general, since the
> C standard says that ctime has undefined behavior if the year is
> before -999 or after 9999. The most straightforward fix is to avoid
> using ctime entirely, and to use strftime instead. But since strftime
> uses localized dates, we might as well fix the FIXME and support
> i18nized time stamps for who and pinky. Here is a proposed patch.
>
> Note that the output format will differ now, outside the POSIX locale.
>
>
> 2004-06-21 Paul Eggert <address@hidden>
>
> The 2004-06-19 fix for who and pinky was incomplete, as ctime
> has undefined behavior if the year precedes -999 or follows 9999.
> Since we have to stop using ctime anyway, we might as well use
> strftime and fix the FIXME, and support internationalized dates.
>
> * NEWS: Document the new behavior.
> * src/who.c: Include "hard-locale.h".
> (time_format, time_format_width): New vars.
> (time_string, print_line): Use them.
> (main): Set them.
> (time_string): Use localtime + strftime instead of
> ctime, to avoid problems with years before -999 or after 9999.
> * src/pinky.c: Likewise.
Thank you. I've applied that.
Unlikely, indeed. Now there's one fewer year-10k bug.