[patch] bug #6524 - ctime() on bad values hangs system

Mark Wielaard mwielaard@redhat.com
Sat May 17 15:49:00 GMT 2008


Hi,

While playing a bit with ctime I hit bug #6524. Since ctime() accepts a
64bit long the year/month/day computation could take ages when given a
bogus epoch offset. The following patch makes it so that the printed
string is capped to somewhat reasonable values, otherwise it just
returns "a long, long time ago...", or "far far in the future...". Care
is taken to make sure that the returned string is always 24 chars wide.
Also included is a new ctime test against some corner case values.

Let me know if this patch is ok, or can be improved.

Thanks

Mark
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ctime.patch
Type: text/x-patch
Size: 4385 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/systemtap/attachments/20080517/82125eb8/attachment.bin>


More information about the Systemtap mailing list