On 32-bit architectures (i386) with support for 64-bit _timet, reading and converting _timet to signed long will fail in 2038.
Let's audit the INN source code for such uses and switch to unsigned long, which will work until 2106. Hopefully 32-bit archs will be long time gone by that time!
A proper fix would be to switch everything to signed long long (8 bytes on 32-bit archs) but that's more complex and a lot of work to do, and very probably useless as it would only be needed in year 2106 for 32-bit archs...
As for the changes to do, a first glance at some parts of the code shows the following patterns to change:
Using unsigned long in printf()-like calls:
time_t date;
- warn("can't format %ld", (long) date);
+ warn("can't format %lu", (unsigned long) date);
Using atoll() instead of atol() when converting strings to _timet:
On 32-bit architectures (i386) with support for 64-bit _timet, reading and converting _timet to signed long will fail in 2038. Let's audit the INN source code for such uses and switch to unsigned long, which will work until 2106. Hopefully 32-bit archs will be long time gone by that time!
A proper fix would be to switch everything to signed long long (8 bytes on 32-bit archs) but that's more complex and a lot of work to do, and very probably useless as it would only be needed in year 2106 for 32-bit archs...
As for the changes to do, a first glance at some parts of the code shows the following patterns to change:
printf()
-like calls:atoll()
instead ofatol()
when converting strings to _timet:strtoul()
instead ofstrtol()
when converting strings to _timet:(unsigned long fits in _timet in both 32 and 64-bit platforms, so adding an explicit cast to _timet is not necessary)