glnx_release_lock_file - Don't close fd -1 (i.e. if we never locked)

This happens a lot if you use autocleanup for lock files, and the
function returns early without the lock being taken.
This commit is contained in:
Alexander Larsson
2016-06-28 11:23:47 +02:00
parent a6d08657aa
commit 4f83b70f69

View File

@@ -187,7 +187,8 @@ void glnx_release_lock_file(GLnxLockFile *f) {
f->path = NULL;
}
(void) close (f->fd);
if (f->fd != -1)
(void) close (f->fd);
f->fd = -1;
f->operation = 0;
}