dup-init: Call loadkey() after locking the repo - 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 da6cffe23132c09ca4599486e396a7b5e2a06a0b DIR parent 1cec40f109d1d6ae9e58b7f1e0fdd6c596155eee HTML Author: sin <sin@2f30.org> Date: Sun, 12 May 2019 10:20:15 +0100 dup-init: Call loadkey() after locking the repo Diffstat: M dup-init.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) --- DIR diff --git a/dup-init.c b/dup-init.c @@ -111,18 +111,23 @@ main(int argc, char *argv[]) repo, STORAGEPATH) >= sizeof(bpath)) errx(1, "snprintf: %s: path too long", bpath); - loadkey(keyfile); if (mkdir(repo, 0700) < 0) err(1, "mkdir: %s", repo); + if ((lfd = lockrepo(repo)) < 0) errx(1, "failed to lock repository"); + if (mkdir(spath, 0700) < 0) err(1, "mkdir: %s", spath); + + loadkey(keyfile); savestate(repo); + if (bcreat(bpath, 0600, &bctx) < 0) berr("bcreat: %s", bpath); if (bclose(bctx) < 0) berr("bclose: %s", bpath); + if (unlockrepo(lfd) < 0) errx(1, "failed to unlock repository"); return 0;