core dump from within asctime_r()
Jonathan Leffler
jonathan.leffler at gmail.com
Tue Feb 2 23:06:15 UTC 2010
On Tue, Feb 2, 2010 at 2:10 PM, Olson, Arthur David (NIH/NCI) [E] <
olsona at dc37a.nci.nih.gov> wrote:
> > It would be possible to make ctime() be
> >
> > tm = localtime(t);
> > if (tm == NULL)
> > return NULL;
> > return asctime(tm);
> >
> > and in theory that would be adequate, but I'm actually going to suggest
> moving the fix into asctime() (into asctime_r() really of course), and have
> > asctime_r() start
> >
> > if (timeptr == NULL)
> > return NULL;
> >
> > I think that's a safer fix. Appended is the patch I suggest, made
> > against the tzcode2009t sources (latest I believe.)
>
> Any sentiment for (or against)...
> if (timeptr == NULL)
> return "?";
> ...or...
> return "??? ??? ?? ??:??:?? ????\n";
> ...or some variant?
>
AS Robert Elz said, if you are going to use a non-null pointer, then I
suggest the 26-character string. As to the contents - I have no problem
with question marks followed by a newline; I think the newline at the end is
a good idea as people may well rely on its presence to format their
information.
--
Jonathan Leffler <jonathan.leffler at gmail.com> #include <disclaimer.h>
Guardian of DBD::Informix - v2008.0513 - http://dbi.perl.org
"Blessed are we who can laugh at ourselves, for we shall never cease to be
amused."
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mm.icann.org/pipermail/tz/attachments/20100202/a17f547d/attachment-0001.html
More information about the tz
mailing list