iDon't unlink lockfile - dedup - deduplicating backup program Err bitreich.org 70 hgit clone git://bitreich.org/dedup/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/dedup/ URL:git://bitreich.org/dedup/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/dedup/ bitreich.org 70 1Log /scm/dedup/log.gph bitreich.org 70 1Files /scm/dedup/files.gph bitreich.org 70 1Refs /scm/dedup/refs.gph bitreich.org 70 1Tags /scm/dedup/tag bitreich.org 70 1README /scm/dedup/file/README.gph bitreich.org 70 1LICENSE /scm/dedup/file/LICENSE.gph bitreich.org 70 i--- Err bitreich.org 70 1commit bc78bdef16f48f02b707bce0f5989f6fcdb175ef /scm/dedup/commit/bc78bdef16f48f02b707bce0f5989f6fcdb175ef.gph bitreich.org 70 1parent dcd160319defab89c482448737c8f80a6b005570 /scm/dedup/commit/dcd160319defab89c482448737c8f80a6b005570.gph bitreich.org 70 hAuthor: sin URL:mailto:sin@2f30.org bitreich.org 70 iDate: Sun, 5 May 2019 20:14:53 +0100 Err bitreich.org 70 i Err bitreich.org 70 iDon't unlink lockfile Err bitreich.org 70 i Err bitreich.org 70 iAvoids some possible race conditions. Err bitreich.org 70 i Err bitreich.org 70 iDiffstat: Err bitreich.org 70 i M lock.c | 10 +--------- Err bitreich.org 70 i M lock.h | 2 +- Err bitreich.org 70 i Err bitreich.org 70 i2 files changed, 2 insertions(+), 10 deletions(-) Err bitreich.org 70 i--- Err bitreich.org 70 1diff --git a/lock.c b/lock.c /scm/dedup/file/lock.c.gph bitreich.org 70 i@@ -30,18 +30,10 @@ lockrepo(char *repo) Err bitreich.org 70 i } Err bitreich.org 70 i Err bitreich.org 70 i int Err bitreich.org 70 i-unlockrepo(char *repo, int fd) Err bitreich.org 70 i+unlockrepo(int fd) Err bitreich.org 70 i { Err bitreich.org 70 i- char path[PATH_MAX]; Err bitreich.org 70 i struct flock fl; Err bitreich.org 70 i Err bitreich.org 70 i- if (snprintf(path, sizeof(path), "%s/lock", repo) >= Err bitreich.org 70 i- sizeof(path)) Err bitreich.org 70 i- return -1; Err bitreich.org 70 i- Err bitreich.org 70 i- if (unlink(path) < 0) Err bitreich.org 70 i- return -1; Err bitreich.org 70 i- Err bitreich.org 70 i fl.l_type = F_UNLCK; Err bitreich.org 70 i fl.l_whence = SEEK_SET; Err bitreich.org 70 i fl.l_start = 0; Err bitreich.org 70 1diff --git a/lock.h b/lock.h /scm/dedup/file/lock.h.gph bitreich.org 70 i@@ -1,2 +1,2 @@ Err bitreich.org 70 i int lockrepo(char *); Err bitreich.org 70 i-int unlockrepo(char *, int); Err bitreich.org 70 i+int unlockrepo(int); Err bitreich.org 70 .