All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-trivial] [PATCH] keep the PID file locked for the lifetime of the process
@ 2012-01-26 21:36 ` Laszlo Ersek
  0 siblings, 0 replies; 16+ messages in thread
From: Laszlo Ersek @ 2012-01-26 21:36 UTC (permalink / raw)
  To: qemu-devel, qemu-trivial

The lockf() call in qemu_create_pidfile() aims at ensuring mutual
exclusion. We shouldn't close the pidfile on success, because that drops
the lock as well [1]:

    "File locks shall be released on first close by the locking process
    of any file descriptor for the file."

Coverity may complain again about the leaked file descriptor; let's
worry about that later.

[1] http://pubs.opengroup.org/onlinepubs/9699919799/functions/lockf.html

Signed-off-by: Laszlo Ersek <lersek@redhat.com>
---
Please keep me CC'd, I'm not subscribed. Thanks!

 os-posix.c |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/os-posix.c b/os-posix.c
index 5c437ca..f4940c8 100644
--- a/os-posix.c
+++ b/os-posix.c
@@ -348,6 +348,5 @@ int qemu_create_pidfile(const char *filename)
         return -1;
     }
 
-    close(fd);
     return 0;
 }
-- 
1.7.1



^ permalink raw reply related	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2012-02-03 17:21 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-01-26 21:36 [Qemu-trivial] [PATCH] keep the PID file locked for the lifetime of the process Laszlo Ersek
2012-01-26 21:36 ` [Qemu-devel] " Laszlo Ersek
2012-01-27  6:36 ` [Qemu-trivial] " Stefan Hajnoczi
2012-01-27  6:36   ` [Qemu-devel] " Stefan Hajnoczi
2012-01-27  8:56   ` Laszlo Ersek
2012-01-27  8:56     ` [Qemu-devel] " Laszlo Ersek
2012-01-27 10:26   ` [Qemu-trivial] [Qemu-devel] " Daniel P. Berrange
2012-01-27 10:26     ` [Qemu-devel] [Qemu-trivial] " Daniel P. Berrange
2012-01-27 13:17 ` [Qemu-trivial] [Qemu-devel] " Markus Armbruster
2012-01-27 13:17   ` Markus Armbruster
2012-01-27 13:34   ` [Qemu-trivial] [PATCH v2] " Laszlo Ersek
2012-01-27 13:34     ` [Qemu-devel] " Laszlo Ersek
2012-01-27 14:48     ` [Qemu-trivial] " Markus Armbruster
2012-01-27 14:48       ` [Qemu-devel] " Markus Armbruster
2012-02-03 17:21     ` [Qemu-trivial] " Anthony Liguori
2012-02-03 17:21       ` Anthony Liguori

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.