diff --git a/src/dnsmasq.c b/src/dnsmasq.c index 045489f..b985b79 100644 --- a/src/dnsmasq.c +++ b/src/dnsmasq.c @@ -1375,7 +1375,7 @@ static void async_event(int pipe, time_t now) /* update timestamp file on TERM if time is considered valid */ if (daemon->back_to_the_future) { - if (utime(daemon->timestamp_file, NULL) == -1) + if (utimes(daemon->timestamp_file, NULL) == -1) my_syslog(LOG_ERR, _("failed to update mtime on %s: %s"), daemon->timestamp_file, strerror(errno)); } #endif diff --git a/src/dnsmasq.h b/src/dnsmasq.h index ee2cd4e..14783c9 100644 --- a/src/dnsmasq.h +++ b/src/dnsmasq.h @@ -117,7 +117,6 @@ typedef unsigned long long u64; #include #include #include -#include #ifndef HAVE_LINUX_NETWORK # include #endif diff --git a/src/dnssec.c b/src/dnssec.c index 90d8a4d..3330eef 100644 --- a/src/dnssec.c +++ b/src/dnssec.c @@ -475,7 +475,7 @@ int setup_timestamp(void) if (difftime(timestamp_time, time(0)) <= 0) { /* time already OK, update timestamp, and do key checking from the start. */ - if (utime(daemon->timestamp_file, NULL) == -1) + if (utimes(daemon->timestamp_file, NULL) == -1) my_syslog(LOG_ERR, _("failed to update mtime on %s: %s"), daemon->timestamp_file, strerror(errno)); daemon->back_to_the_future = 1; return 0; @@ -489,12 +489,14 @@ int setup_timestamp(void) int fd = open(daemon->timestamp_file, O_WRONLY | O_CREAT | O_NONBLOCK | O_EXCL, 0666); if (fd != -1) { - struct utimbuf timbuf; + struct timeval tv[2]; close(fd); - timestamp_time = timbuf.actime = timbuf.modtime = 1420070400; /* 1-1-2015 */ - if (utime(daemon->timestamp_file, &timbuf) == 0) + timestamp_time = 1420070400; /* 1-1-2015 */ + tv[0].tv_sec = tv[1].tv_sec = timestamp_time; + tv[0].tv_usec = tv[1].tv_usec = 0; + if (utimes(daemon->timestamp_file, tv) == 0) goto check_and_exit; } } @@ -519,7 +521,7 @@ static int check_date_range(u32 date_start, u32 date_end) { if (daemon->back_to_the_future == 0 && difftime(timestamp_time, curtime) <= 0) { - if (utime(daemon->timestamp_file, NULL) != 0) + if (utimes(daemon->timestamp_file, NULL) != 0) my_syslog(LOG_ERR, _("failed to update mtime on %s: %s"), daemon->timestamp_file, strerror(errno)); my_syslog(LOG_INFO, _("system time considered valid, now checking DNSSEC signature timestamps."));