Don't unlink lockfile - dedup - deduplicating backup program
(HTM) git clone git://bitreich.org/dedup/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/dedup/
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) Tags
(DIR) README
(DIR) LICENSE
---
(DIR) commit bc78bdef16f48f02b707bce0f5989f6fcdb175ef
(DIR) parent dcd160319defab89c482448737c8f80a6b005570
(HTM) Author: sin <sin@2f30.org>
Date: Sun, 5 May 2019 20:14:53 +0100
Don't unlink lockfile
Avoids some possible race conditions.
Diffstat:
M lock.c | 10 +---------
M lock.h | 2 +-
2 files changed, 2 insertions(+), 10 deletions(-)
---
(DIR) diff --git a/lock.c b/lock.c
@@ -30,18 +30,10 @@ lockrepo(char *repo)
}
int
-unlockrepo(char *repo, int fd)
+unlockrepo(int fd)
{
- char path[PATH_MAX];
struct flock fl;
- if (snprintf(path, sizeof(path), "%s/lock", repo) >=
- sizeof(path))
- return -1;
-
- if (unlink(path) < 0)
- return -1;
-
fl.l_type = F_UNLCK;
fl.l_whence = SEEK_SET;
fl.l_start = 0;
(DIR) diff --git a/lock.h b/lock.h
@@ -1,2 +1,2 @@
int lockrepo(char *);
-int unlockrepo(char *, int);
+int unlockrepo(int);