summaryrefslogtreecommitdiffstats
path: root/src/lock.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lock.c')
-rw-r--r--src/lock.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/lock.c b/src/lock.c
index 465736c..eb8a3cb 100644
--- a/src/lock.c
+++ b/src/lock.c
@@ -34,7 +34,9 @@
#include "util.h"
// Where do lockfiles reside?
-#define LOCK_PATH "/var/lock"
+#ifndef LOCK_DIR
+#define LOCK_DIR "/var/lock"
+#endif
static char* lockfile = NULL;
@@ -48,10 +50,10 @@ int device_lock(char *dev, char *appname) {
assert(dev && !lockfile);
- if (access(LOCK_PATH, W_OK) < 0)
+ if (access(LOCK_DIR, W_OK) < 0)
return -1;
- snprintf(path, sizeof(path), "%s/LCK..%s", LOCK_PATH, basename(dev));
+ snprintf(path, sizeof(path), "%s/LCK..%s", LOCK_DIR, basename(dev));
if ((fd = open(path, O_RDONLY)) >= 0) {
int n = loop_read(fd, buf, sizeof(buf) - 1);