Re: [PATCH 05/22] lockfile: unlock file if lockfile permissions cannot be adjusted
diff --git a/lockfile.c b/lockfile.c
index c1af65b..1928e5e 100644
--- a/lockfile.c
+++ b/lockfile.c
@@ -148,9 +148,11 @@ static int lock_file(struct lock_file *lk, const char *path, int flags)
lock_file_list = lk;
lk->on_list = 1;
}
- if (adjust_shared_perm(lk->filename))
- return error("cannot fix permission bits on %s",
- lk->filename);
+ if (adjust_shared_perm(lk->filename)) {
+ error("cannot fix permission bits on %s", lk->filename);
+ rollback_lock_file(lk);
+ return -1;
Would it make sense to change the order of rollback() and error()?
Make the rollback first (and as early as possible) and whine then?