diff options
author | Jim Meyering <meyering@redhat.com> | 2012-08-22 13:55:52 +0200 |
---|---|---|
committer | Anthony Liguori <aliguori@us.ibm.com> | 2012-08-22 10:47:14 -0500 |
commit | 4144f122b477164cf466ca69be24cf4ef5c218d3 (patch) | |
tree | a7f93d86ed886f5f7ba654eae2f20ad7e68b8f75 /qemu-ga.c | |
parent | 0ec64507a5e6366e6d8070a82c866b935f687ed9 (diff) | |
download | qemu-4144f122b477164cf466ca69be24cf4ef5c218d3.tar.gz qemu-4144f122b477164cf466ca69be24cf4ef5c218d3.tar.bz2 qemu-4144f122b477164cf466ca69be24cf4ef5c218d3.zip |
qemu-ga: don't leak a file descriptor upon failed lockf
Signed-off-by: Jim Meyering <meyering@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'qemu-ga.c')
-rw-r--r-- | qemu-ga.c | 3 |
1 files changed, 3 insertions, 0 deletions
@@ -247,6 +247,9 @@ static bool ga_open_pidfile(const char *pidfile) pidfd = open(pidfile, O_CREAT|O_WRONLY, S_IRUSR|S_IWUSR); if (pidfd == -1 || lockf(pidfd, F_TLOCK, 0)) { g_critical("Cannot lock pid file, %s", strerror(errno)); + if (pidfd != -1) { + close(pidfd); + } return false; } |