[libglnx] glnx_release_lock_file - Don't close fd -1 (i.e. if we never locked)
- From: Alexander Larsson <alexl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libglnx] glnx_release_lock_file - Don't close fd -1 (i.e. if we never locked)
- Date: Tue, 28 Jun 2016 09:38:26 +0000 (UTC)
commit 4f83b70f690f437b983333a7c43def3ed6ca2d46
Author: Alexander Larsson <alexl redhat com>
Date: Tue Jun 28 11:23:47 2016 +0200
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.
glnx-lockfile.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
---
diff --git a/glnx-lockfile.c b/glnx-lockfile.c
index be9ad3a..7dd69e9 100644
--- a/glnx-lockfile.c
+++ b/glnx-lockfile.c
@@ -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;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]