Commit 93dd748b authored by Laszlo Ersek's avatar Laszlo Ersek Committed by Anthony Liguori

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.

- add reference to 1bbd1592
- explain the intentional fd leak in the source

[1] default avatarLaszlo Ersek <>
Signed-off-by: default avatarAnthony Liguori <>
parent d34e8f6e
......@@ -348,6 +348,6 @@ int qemu_create_pidfile(const char *filename)
return -1;
/* keep pidfile open & locked forever */
return 0;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment