diff options
| author | Markus Armbruster | 2013-01-11 11:24:59 +0100 |
|---|---|---|
| committer | Michael Roth | 2013-01-14 19:07:48 +0100 |
| commit | 03ac10f166b790cb66804e512abec6d002cd8481 (patch) | |
| tree | 463fb89c78932551b6b5b23310a57c52cdb5ea2c /qga | |
| parent | qemu-ga: Drop pointless lseek() from ga_open_pidfile() (diff) | |
| download | qemu-03ac10f166b790cb66804e512abec6d002cd8481.tar.gz qemu-03ac10f166b790cb66804e512abec6d002cd8481.tar.xz qemu-03ac10f166b790cb66804e512abec6d002cd8481.zip | |
qemu-ga: Plug file descriptor leak on ga_open_pidfile() error path
Spotted by Coverity. Also document why we keep it open on success.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Reviewed-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Diffstat (limited to 'qga')
| -rw-r--r-- | qga/main.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/qga/main.c b/qga/main.c index 96d3cfa381..db281a508b 100644 --- a/qga/main.c +++ b/qga/main.c @@ -299,10 +299,12 @@ static bool ga_open_pidfile(const char *pidfile) goto fail; } + /* keep pidfile open & locked forever */ return true; fail: unlink(pidfile); + close(pidfd); return false; } #else /* _WIN32 */ |
