summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Agner <stefan@agner.ch>2020-11-13 10:42:33 +0100
committerRoland Hieber <rhi@pengutronix.de>2021-03-16 15:29:13 +0100
commitfd48fe4efb40f35b119958495d56b399bec73654 (patch)
treeed3d57307e107eac2a351be04b1c0679e832047c
parent0a75604bc61f74fb798001f308cf8b6406974db9 (diff)
downloaddt-utils-next.tar.gz
state: use /run to store lockfilenext
The current location /var/lock is considered legacy (at least by systemd). Just use /run to store the lockfile and append the usual .lock suffix. Signed-off-by: Stefan Agner <stefan@agner.ch> Message-Id: <44672659d2a88d7268d71b16f756dc991e20e10f.1605260461.git.stefan@agner.ch> Tested-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Roland Hieber <rhi@pengutronix.de>
-rw-r--r--src/barebox-state.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/barebox-state.c b/src/barebox-state.c
index afd18c6..334aed6 100644
--- a/src/barebox-state.c
+++ b/src/barebox-state.c
@@ -38,6 +38,8 @@
#include <dt/dt.h>
#include <state.h>
+#define BAREBOX_STATE_LOCKFILE "/run/barebox-state.lock"
+
struct state_variable;
static int __state_uint8_set(struct state_variable *var, const char *val);
@@ -541,15 +543,15 @@ int main(int argc, char *argv[])
++nr_states;
}
- lock_fd = open("/var/lock/barebox-state", O_CREAT | O_RDWR, 0600);
+ lock_fd = open(BAREBOX_STATE_LOCKFILE, O_CREAT | O_RDWR, 0600);
if (lock_fd < 0) {
- pr_err("Failed to open lock-file /var/lock/barebox-state\n");
+ pr_err("Failed to open lock-file " BAREBOX_STATE_LOCKFILE "\n");
exit(1);
}
ret = flock(lock_fd, LOCK_EX);
if (ret < 0) {
- pr_err("Failed to lock /var/lock/barebox-state: %m\n");
+ pr_err("Failed to lock " BAREBOX_STATE_LOCKFILE ": %m\n");
close(lock_fd);
exit(1);
}