From: Torsten Bögershausen Date: Wed, 02 Apr 2014 06:47:39 GMT Subject: Re: [PATCH 05/22] lockfile: unlock file if lockfile permissions cannot be adjusted Message-ID: <533BB28B.10906@web.de> In-Reply-To: <1396367910-7299-6-git-send-email-mhagger@alum.mit.edu> [] 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?