From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: Received: from mail.kmu-office.ch ([2a02:418:6a02::a2]) by metis.ext.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kdVbN-0005IR-12 for oss-tools@pengutronix.de; Fri, 13 Nov 2020 10:42:42 +0100 From: Stefan Agner Date: Fri, 13 Nov 2020 10:42:33 +0100 Message-Id: <44672659d2a88d7268d71b16f756dc991e20e10f.1605260461.git.stefan@agner.ch> MIME-Version: 1.0 Subject: [OSS-Tools] [PATCH dt-utils] state: use /run to store lockfile List-Id: Pengutronix Public Open-Source-Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: oss-tools-bounces@pengutronix.de Sender: "OSS-Tools" To: oss-tools@pengutronix.de 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 --- src/barebox-state.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/barebox-state.c b/src/barebox-state.c index 946a8db..16a8c9f 100644 --- a/src/barebox-state.c +++ b/src/barebox-state.c @@ -38,6 +38,8 @@ #include
#include +#define BAREBOX_STATE_LOCKFILE "/run/barebox-state.lock" + struct state_variable; static int __state_uint8_set(struct state_variable *var, const char *val); @@ -505,15 +507,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); } -- 2.29.2 _______________________________________________ OSS-Tools mailing list OSS-Tools@pengutronix.de