qemu-trivial
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-trivial] [PATCH] keep the PID file locked for the lifetime of the


From: Laszlo Ersek
Subject: [Qemu-trivial] [PATCH] keep the PID file locked for the lifetime of the process
Date: Thu, 26 Jan 2012 22:36:41 +0100

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 <address@hidden>
---
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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]