]> git.proxmox.com Git - qemu.git/commit
keep the PID file locked for the lifetime of the process
authorLaszlo Ersek <lersek@redhat.com>
Fri, 27 Jan 2012 13:34:05 +0000 (14:34 +0100)
committerAnthony Liguori <aliguori@us.ibm.com>
Wed, 1 Feb 2012 22:23:57 +0000 (16:23 -0600)
commit93dd748b789202af4f5be75412c58ee1ed481b29
tree50b77d8d2bd0090d0f901522c0788811d62224b6
parentd34e8f6e9d3a396c3327aa9807c83f9e1f4a7bd7
keep the PID file locked for the lifetime of the process

The lockf() call in qemu_create_pidfile() aims at ensuring mutual
exclusion. We shouldn't close the pidfile on success (as introduced by
commit 1bbd1592), 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.

v1->v2:
- add reference to 1bbd1592
- explain the intentional fd leak in the source

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

Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
os-posix.c