mirror of
https://github.com/pi-hole/dnsmasq.git
synced 2025-12-19 10:18:25 +00:00
Replace obsolete utime() usage with utimes().
This fixes build time warnings with POSIX.1-2008-aware c libraries.
This commit is contained in:
committed by
Simon Kelley
parent
561441320f
commit
4583dd9e42
@@ -1375,7 +1375,7 @@ static void async_event(int pipe, time_t now)
|
|||||||
/* update timestamp file on TERM if time is considered valid */
|
/* update timestamp file on TERM if time is considered valid */
|
||||||
if (daemon->back_to_the_future)
|
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));
|
my_syslog(LOG_ERR, _("failed to update mtime on %s: %s"), daemon->timestamp_file, strerror(errno));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -117,7 +117,6 @@ typedef unsigned long long u64;
|
|||||||
#include <sys/uio.h>
|
#include <sys/uio.h>
|
||||||
#include <syslog.h>
|
#include <syslog.h>
|
||||||
#include <dirent.h>
|
#include <dirent.h>
|
||||||
#include <utime.h>
|
|
||||||
#ifndef HAVE_LINUX_NETWORK
|
#ifndef HAVE_LINUX_NETWORK
|
||||||
# include <net/if_dl.h>
|
# include <net/if_dl.h>
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
12
src/dnssec.c
12
src/dnssec.c
@@ -475,7 +475,7 @@ int setup_timestamp(void)
|
|||||||
if (difftime(timestamp_time, time(0)) <= 0)
|
if (difftime(timestamp_time, time(0)) <= 0)
|
||||||
{
|
{
|
||||||
/* time already OK, update timestamp, and do key checking from the start. */
|
/* 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));
|
my_syslog(LOG_ERR, _("failed to update mtime on %s: %s"), daemon->timestamp_file, strerror(errno));
|
||||||
daemon->back_to_the_future = 1;
|
daemon->back_to_the_future = 1;
|
||||||
return 0;
|
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);
|
int fd = open(daemon->timestamp_file, O_WRONLY | O_CREAT | O_NONBLOCK | O_EXCL, 0666);
|
||||||
if (fd != -1)
|
if (fd != -1)
|
||||||
{
|
{
|
||||||
struct utimbuf timbuf;
|
struct timeval tv[2];
|
||||||
|
|
||||||
close(fd);
|
close(fd);
|
||||||
|
|
||||||
timestamp_time = timbuf.actime = timbuf.modtime = 1420070400; /* 1-1-2015 */
|
timestamp_time = 1420070400; /* 1-1-2015 */
|
||||||
if (utime(daemon->timestamp_file, &timbuf) == 0)
|
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;
|
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 (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_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."));
|
my_syslog(LOG_INFO, _("system time considered valid, now checking DNSSEC signature timestamps."));
|
||||||
|
|||||||
Reference in New Issue
Block a user