[PATCH v5 17/35] commit_lock_file(): die() if called for unlocked lockfile object

2014-09-16 Thread Michael Haggerty
It was previously a bug to call commit_lock_file() with a lock_file object that was not active (an illegal access would happen within the function). It was presumably never done, but this would be an easy programming error to overlook. So before continuing, do a consistency check that the

Re: [PATCH v5 17/35] commit_lock_file(): die() if called for unlocked lockfile object

2014-09-16 Thread Jonathan Nieder
Michael Haggerty wrote: --- a/lockfile.c +++ b/lockfile.c @@ -312,6 +312,9 @@ int commit_lock_file(struct lock_file *lk) { char result_file[PATH_MAX]; + if (!lk-filename[0]) + die(BUG: attempt to commit unlocked object); Sure, this is fine instead of an assert()