]> git.proxmox.com Git - qemu.git/blobdiff - os-posix.c
Version 1.0.1
[qemu.git] / os-posix.c
index dbf3b240f73aedb810f9d4950c2acf6dfccf5d5f..dc4a6bb3fffa98d80144284412e7b575f72d914e 100644 (file)
@@ -372,13 +372,16 @@ int qemu_create_pidfile(const char *filename)
         return -1;
     }
     if (lockf(fd, F_TLOCK, 0) == -1) {
+        close(fd);
         return -1;
     }
     len = snprintf(buffer, sizeof(buffer), FMT_pid "\n", getpid());
     if (write(fd, buffer, len) != len) {
+        close(fd);
         return -1;
     }
 
+    close(fd);
     return 0;
 }