[PATCH] ctdb: Fix a 32-bit problem
Volker Lendecke
Volker.Lendecke at SerNet.DE
Fri Sep 4 11:56:31 UTC 2015
On Fri, Sep 04, 2015 at 01:45:09PM +0200, Jérémie Courrèges-Anglas wrote:
> Volker Lendecke <Volker.Lendecke at SerNet.DE> writes:
>
> > Hi!
>
> Hi Volker,
>
> > Review&push appreciated!
>
> I am mildly concerned with this approach. At least two
> implementations out there use 64 bits time_t on 32 bits (and 64 bits)
> systems: NetBSD, OpenBSD. Linux x32 also uses 64 bits time_t.
>
> The OpenBSD source and ports tree has received loads of fixes. It turns
> out that the most portable way to print time_t is to use %lld and an
> explicit (long long) cast. eg.
>
> @@ -1095,7 +1095,7 @@ static void ctdb_tevent_trace(enum tevent_trace_point tp,
> if (diff.tv_sec > 3) {
> DEBUG(DEBUG_CRIT,
> ("No event for %lld seconds!\n",
> - diff.tv_sec));
> + (long long)diff.tv_sec));
> }
> }
> tevent_after_wait_ts = now;
>
> Samba 4 already assumes that long long is available.
>
> Chances are that 32 bits OSes and Samba will still coexist in 2038.
> Would patches using the idiom presented above be welcome in the samba
> source tree?
>
> http://www.openbsd.org/papers/eurobsdcon_2013_time_t/mgp00011.html
Sure, I did not really think very long about this change. I
just adapted the cast to what the printf format did. If we
want something else for printing time_t, be my guest!
Do you want to submit a git format-patch patch for this?
Thanks!
Volker
--
SerNet GmbH, Bahnhofsallee 1b, 37081 Göttingen
phone: +49-551-370000-0, fax: +49-551-370000-9
AG Göttingen, HRB 2816, GF: Dr. Johannes Loxen
http://www.sernet.de, mailto:kontakt at sernet.de
More information about the samba-technical
mailing list