Break out load_cache() - dedup - deduplicating backup program
HTML git clone git://bitreich.org/dedup/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/dedup/
DIR Log
DIR Files
DIR Refs
DIR Tags
DIR README
DIR LICENSE
---
DIR commit 947a779321210f9080b129607d83c444837a2083
DIR parent 514871477eab5d433ff6e942f1438d321e2e2dd0
HTML Author: sin <sin@2f30.org>
Date: Sat, 2 Mar 2019 12:56:59 +0000
Break out load_cache()
Diffstat:
M dedup.c | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
---
DIR diff --git a/dedup.c b/dedup.c
@@ -532,8 +532,6 @@ init(int iflag)
{
int flags;
- cache = alloc_cache();
-
flags = O_RDWR;
if (iflag)
flags |= O_CREAT | O_EXCL;
@@ -561,8 +559,10 @@ init(int iflag)
} else {
load_snap_hdr();
load_blk_hdr();
- load_cache();
}
+
+ cache = alloc_cache();
+ load_cache();
}
static void
@@ -572,18 +572,18 @@ term(void)
print_stats(&snap_hdr.st);
save_cache();
+ free_cache(cache);
+
save_blk_hdr();
save_snap_hdr();
- fsync(ifd);
- fsync(sfd);
fsync(cfd);
+ fsync(sfd);
+ fsync(ifd);
- close(ifd);
- close(sfd);
close(cfd);
-
- free_cache(cache);
+ close(sfd);
+ close(ifd);
}
static void