[elinks-dev] elinks and 64-bit time_t

Edd Barrett vext01 at gmail.com
Thu Oct 10 13:31:52 PDT 2013


Hi,

I have just comitted a fix for elinks to OpenBSD:
http://www.openbsd.org/cgi-bin/cvsweb/~checkout~/ports/www/elinks/patches/patch-src_util_time_h?rev=1.1;content-type=text%2Fplain

The timeval_T struct defined in src/util/time.h uses a long for the seconds.
Pointers to this struct are then passed to select(2), which expects a
pointer to a timeval_t (from sys/time.h).  On OpenBSD (and probably other
platforms too), the seconds field in a timeval_t is a 64-bit signed integer
(a.k.a. time_t). So to use a long for the seconds field is wrong, since on
some arches (e.g. i386), a long is 4 bytes. This screws things up and makes
calls to select(2) fail, thus elinks fails to run.

There is a comment above the timeval_T definition which I don't pretend to
understand. Why don't you use the host system's timeval_t from sys/time.h,
rather than defining your own?

-- 
Best Regards
Edd Barrett

http://www.theunixzoo.co.uk



More information about the elinks-dev mailing list