]> granicus.if.org Git - sudo/commit
We cannot (easily) use clock_gettime(CLOCK_MONOTONIC) directly as
authorTodd C. Miller <Todd.Miller@courtesan.com>
Tue, 24 Feb 2015 18:19:21 +0000 (11:19 -0700)
committerTodd C. Miller <Todd.Miller@courtesan.com>
Tue, 24 Feb 2015 18:19:21 +0000 (11:19 -0700)
commit5d2e9426b271592722b2f98d763a29ae23f38973
tree781eddd5009469fd0b284cc5bcf89769e2ce2fa6
parent01a4d6ccbf9cc9fc3d65763f37fc8cb8f612f55a
We cannot (easily) use clock_gettime(CLOCK_MONOTONIC) directly as
it may be present but not implemented.  Add sudo_gettime_real() and
sudo_gettime_mono() functions to get the real and monotonic times
respectively.  Now sudo_gettime_mono() checks the value of
sysconf(_SC_MONOTONIC_CLOCK) before calling clock_gettime(CLOCK_MONOTONIC)
and falls back on sudo_gettime_real() as needed.  The Mach version
of sudo_gettime_mono() uses mach_absolute_time().

This should fix problems with timestamp files on systems where
the CLOCK_MONOTONIC is defined but not actually implemented.
12 files changed:
MANIFEST
configure
configure.ac
include/sudo_compat.h
lib/util/Makefile.in
lib/util/clock_gettime.c [deleted file]
mkdep.pl
plugins/sudoers/Makefile.in
plugins/sudoers/gettime.c [new file with mode: 0644]
plugins/sudoers/po/sudoers.pot
plugins/sudoers/sudoers.h
plugins/sudoers/timestamp.c