commit bc78bdef16f48f02b707bce0f5989f6fcdb175ef
parent dcd160319defab89c482448737c8f80a6b005570
Author: sin <sin@2f30.org>
Date: Sun, 5 May 2019 20:14:53 +0100
Don't unlink lockfile
Avoids some possible race conditions.
Diffstat:
2 files changed, 2 insertions(+), 10 deletions(-)
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;
diff --git a/lock.h b/lock.h
@@ -1,2 +1,2 @@
int lockrepo(char *);
-int unlockrepo(char *, int);
+int unlockrepo(int);