diff options
| author | Laurent Bercot <ska-skaware@skarnet.org> | 2023-07-12 16:53:59 +0000 |
|---|---|---|
| committer | Laurent Bercot <ska@appnovation.com> | 2023-07-12 16:53:59 +0000 |
| commit | 207845f50a8fb54fe8e584928078dc3687399caf (patch) | |
| tree | f58eac67edc2dbaba13a48442a2093f76e869991 /src/libs6dns/s6dns_hosts_init.c | |
| parent | 8cf671e973a4ea2ef7c9ca1321531a7ceeaa5073 (diff) | |
| download | s6-dns-207845f50a8fb54fe8e584928078dc3687399caf.tar.gz | |
Pass on all clients, add hosts support wherever applicable
Signed-off-by: Laurent Bercot <ska@appnovation.com>
Diffstat (limited to 'src/libs6dns/s6dns_hosts_init.c')
| -rw-r--r-- | src/libs6dns/s6dns_hosts_init.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/libs6dns/s6dns_hosts_init.c b/src/libs6dns/s6dns_hosts_init.c index 762d738..8f78ab1 100644 --- a/src/libs6dns/s6dns_hosts_init.c +++ b/src/libs6dns/s6dns_hosts_init.c @@ -5,6 +5,7 @@ #include <errno.h> #include <stdlib.h> #include <sys/stat.h> +#include <time.h> #include <skalibs/posixplz.h> #include <skalibs/cdb.h> @@ -12,7 +13,7 @@ #include <s6-dns/hosts.h> -int s6dns_hosts_init_r (cdb *c, char const *txtfile, char const *cdbfile, char const *tmpprefix) +int s6dns_hosts_init (cdb *c, char const *txtfile, char const *cdbfile, char const *tmpprefix) { int fdr ; int fdc = openc_read(cdbfile) ; @@ -25,7 +26,8 @@ int s6dns_hosts_init_r (cdb *c, char const *txtfile, char const *cdbfile, char c if (errno == ENOENT) goto useit ; else goto errc ; } - if (stc.st_mtim > str.st_mtim) goto useit ; + if (stc.st_mtim.tv_sec > str.st_mtim.tv_sec + || (stc.st_mtim.tv_sec == str.st_mtim.tv_sec && stc.st_mtim.tv_nsec > str.st_mtim.tv_nsec)) goto useit ; fd_close(fdc) ; } |
