]> git.ipfire.org Git - thirdparty/libvirt.git/commit
virPCIDeviceGetVPD: Fix multiple error handling bugs
authorPeter Krempa <pkrempa@redhat.com>
Mon, 29 Jan 2024 15:59:20 +0000 (16:59 +0100)
committerPeter Krempa <pkrempa@redhat.com>
Wed, 31 Jan 2024 16:24:07 +0000 (17:24 +0100)
commitbac86dd36e2c8c56e3d5678a94fc69f8e41a7d35
treed0f110fdfa1eeb416c8509b1141fc9ad77873539
parent3ca1079318b8047a32ae05e1c6e5fb2dac9fc719
virPCIDeviceGetVPD: Fix multiple error handling bugs

- fix passing of 'errno' to 'virReportSystemError'

 The 'open' syscall returns '-1' and sets 'errno' on failure. The code
 passed '-fd' as 'errno' rather than errno itself, thus always reporting
 EPERM.

- don't overwrite errors when closing FD

 Use VIR_AUTOCLOSE to avoid overwriting the errors from virPCIVPDParse.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
src/util/virpci.c