From c731173b493fe90b0dec11ef966e94c93a6e6d89 Mon Sep 17 00:00:00 2001 From: Henrik Hautakoski Date: Thu, 17 Oct 2013 15:51:02 +0200 Subject: [PATCH] lockfile.c: in hold_lock(), Should report 'filename' instead of 'lock->name' if file is locked --- lockfile.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lockfile.c b/lockfile.c index 06821dd..9e6f463 100644 --- a/lockfile.c +++ b/lockfile.c @@ -145,8 +145,10 @@ int hold_lock(struct lockfile *lock, const char *filename, int force) { lock->fd = open_lock(lock->name, force); if (lock->fd < 0) { - return error(errno == EEXIST ? "'%s' is locked" : - "unable to create lockfile '%s'", lock->name); + if (errno == EEXIST) + return error("'%s' is locked", filename); + + return error("unable to create lockfile '%s'", lock->name); } lock->next = active_locks;