dedup

deduplicating backup program
git clone git://git.2f30.org/dedup
Log | Files | Refs | README | LICENSE

commit 947a779321210f9080b129607d83c444837a2083
parent 514871477eab5d433ff6e942f1438d321e2e2dd0
Author: sin <sin@2f30.org>
Date:   Sat,  2 Mar 2019 12:56:59 +0000

Break out load_cache()

Diffstat:
Mdedup.c | 18+++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)

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