commit 9e6393b24468ea6887fa8a703f4e4b4f939e53fb
parent 31bcb5d7c375ac842c005579961586d42e019e7b
Author: sin <sin@2f30.org>
Date: Tue, 5 Mar 2019 12:02:40 +0000
Truncate cache before reloading it
Diffstat:
1 file changed, 2 insertions(+), 0 deletions(-)
diff --git a/dedup.c b/dedup.c
@@ -553,6 +553,8 @@ load_cache(void)
if (nr_entries != snap_hdr.st.nr_blks) {
if (verbose > 0)
fprintf(stderr, "Rebuilding cache\n");
+ if (ftruncate(cfd, 0) < 0)
+ err(1, "ftruncate");
xlseek(ifd, SNAP_HDR_SIZE, SEEK_SET);
walk_snap(reload_cache, NULL);
return;