diff options
author | Laurent Bercot <ska-skaware@skarnet.org> | 2020-12-29 23:07:18 +0000 |
---|---|---|
committer | Laurent Bercot <ska-skaware@skarnet.org> | 2020-12-29 23:07:18 +0000 |
commit | e5f5b81d65a5ed9b34910a58707b870d677c6183 (patch) | |
tree | 6e87cfda96222560751e200ca5ef7dd8d7cd65f4 /src/caches/dcache_save.c | |
parent | 5b063a4db3e631d40c05b77ecc7554ebdf5fff92 (diff) | |
download | s6-dns-e5f5b81d65a5ed9b34910a58707b870d677c6183.tar.xz |
Refactor libdcache, expose dcache_clean_expired()
Diffstat (limited to 'src/caches/dcache_save.c')
-rw-r--r-- | src/caches/dcache_save.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/caches/dcache_save.c b/src/caches/dcache_save.c index 1ef35f0..04d1dac 100644 --- a/src/caches/dcache_save.c +++ b/src/caches/dcache_save.c @@ -1,6 +1,7 @@ /* ISC license. */ #include <stdint.h> +#include <unistd.h> #include <stdio.h> #include <skalibs/posixplz.h> @@ -57,7 +58,7 @@ int dcache_save (dcache_t const *z, char const *file) fd = open_excl(sa.s) ; if (fd == -1) goto err0 ; buffer_init(&b, &buffer_write, fd, buf, N) ; - if (!dcache_save_to_buffer(z, &b)) goto err2 ; + if (!dcache_save_to_buffer(z, &b) || fsync(fd) < 0) goto err2 ; fd_close(fd) ; if (rename(sa.s, file) == -1) goto err1 ; stralloc_free(&sa) ; |