dedup

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

commit da6cffe23132c09ca4599486e396a7b5e2a06a0b
parent 1cec40f109d1d6ae9e58b7f1e0fdd6c596155eee
Author: sin <sin@2f30.org>
Date:   Sun, 12 May 2019 10:20:15 +0100

dup-init: Call loadkey() after locking the repo

Diffstat:
Mdup-init.c | 7++++++-
1 file changed, 6 insertions(+), 1 deletion(-)

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;