• P
    Pass a correct pointer type to localtime_r(3). · 15d2c9fa
    Paul Eggert 提交于
    On 09/04/2012 08:20 AM, Eric Blake wrote:
    > tv_sec is required by POSIX to be
    > of type time_t; so this is a bug in the OpenBSD header
    > [for declaring it as long]
    
    Most likely this problem arose because of the patch I pushed
    in gnulib commit e07d7c40f3ca5ec410cf5aa6fa03cfe51e712039.
    Previously, gnulib required timeval's tv_sec to be
    the same size as time_t.  But now, it requires only that
    tv_sec be big enough to hold a time_t.
    
    This patch was needed for Emacs.  Without the patch, gnulib
    replaced struct timeval on OpenBSD, and this messed up
    utimens.c, and Emacs wouldn't build.
    
    Alternatively, gnulib could substitute its own struct timeval
    for the system's, wrapping every struct timeval-using function
    (gettimeofday, futimesat, futimes, lutimes, etc.  That'd be
    more work, though.  And it would introduce some performance
    issues with gettimeofday, which is supposed to be fast.
    
    I've been trying to get away from using struct timeval,
    and to use the higher-resolution struct timespec instead,
    so messing with these obsolescent interfaces has been
    lower priority for me.  But if someone wants to take the
    more-ambitious approach that'd be fine, I expect.
    
    For this particular case, though, how about if we avoid
    the problem entirely?  libvirt doesn't need to use struct
    timeval here at all.  It makes libvirt smaller and probably
    faster, and it ports to OpenBSD without messing with gnulib.
    15d2c9fa
AUTHORS 11.8 KB