mirror of
https://github.com/xen-project/xen.git
synced 2026-10-30 03:00:05 +01:00
libxl: correct file open success check in libxl__device_pci_reset
It could, even if only in theory, be fd 0. (This is not the same as commit 4b62556b57!) Coverity-ID: 1055895 Signed-off-by: Matthew Daley <mattd@bugfuzz.com> Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
This commit is contained in:
1 parent
cb08944a48
commit
3928e5ccdb
1 file changed
+1
-1
@@ -979,7 +979,7 @@ static int libxl__device_pci_reset(libxl__gc *gc, unsigned int domain, unsigned
|
||||
LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "Failed to access pciback path %s", reset);
|
||||
reset = libxl__sprintf(gc, "%s/"PCI_BDF"/reset", SYSFS_PCI_DEV, domain, bus, dev, func);
|
||||
fd = open(reset, O_WRONLY);
|
||||
if (fd > 0) {
|
||||
if (fd >= 0) {
|
||||
rc = write(fd, "1", 1);
|
||||
if (rc < 0)
|
||||
LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "write to %s returned %d", reset, rc);
|
||||
|
||||