oslib-posix:Fix handle fd leak in qemu_write_pidfile()
From: alexchen <[email protected]>
The fd will leak when (a.st_ino == b.st_ino) is true, fix it.
Signed-off-by AlexChen <[email protected]>
--- util/oslib-posix.c | 1 + 1 file changed, 1 insertion(+)
util/oslib-posix.c +1 -0
@@ -176,6 +176,7 @@ bool qemu_write_pidfile(const char *path, Error **errp) goto fail_unlink; } +close (fd);return true; fail_unlink:
Signature · 1 line
2.19.1
Quoted 3 lines · AlexChen
From: alexchen <[email protected]>
The fd will leak when (a.st_ino == b.st_ino) is true, fix it.
That is *INTENTIONAL*. We're holding a lock on the file and the lock exists only while the FD is open. When QEMU exists, the FD is closed and the lock is released. There is no leak.
Quoted 21 lines
Signed-off-by AlexChen <[email protected]>--- util/oslib-posix.c | 1 + 1 file changed, 1 insertion(+)util/oslib-posix.c +1
-0@@ -176,6 +176,7 @@ bool qemu_write_pidfile(const char *path, Error **errp) goto fail_unlink; } +close (fd);return true; fail_unlink:Signature · 1 line
2.19.1
Regards,
Daniel
Signature · 3 lines
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
Quoted 8 lines · Daniel P. Berrangé
Quoted 3 lines · AlexChen
Quoted 3 lines
From: alexchen <[email protected]>
The fd will leak when (a.st_ino == b.st_ino) is true, fix it.
That is *INTENTIONAL*. We're holding a lock on the file and the lock exists only while the FD is open. When QEMU exists, the FD is closed and the lock is released. There is no leak.
OK, I got it, thanks.
Thanks
Alex