core dump from within asctime_r()

Olson, Arthur David (NIH/NCI) [E] olsona at dc37a.nci.nih.gov
Tue Feb 2 22:10:57 UTC 2010


> 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?

				--ado








More information about the tz mailing list