From: Matthew Daley Date: Wed, 30 Oct 2013 07:51:51 +0000 (+1300) Subject: libxl: correct file open success check in libxl__device_pci_reset X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~6101 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=4b62556b575ef9b10449136b32282eb77a4ef7ac;p=xen.git libxl: correct file open success check in libxl__device_pci_reset It could, even if only in theory, be fd 0. Coverity-ID: 1055895 Signed-off-by: Matthew Daley Reviewed-by: Andrew Cooper Acked-by: Ian Campbell --- diff --git a/tools/libxl/libxl_pci.c b/tools/libxl/libxl_pci.c index b9960bb6ce..26ba3e665c 100644 --- a/tools/libxl/libxl_pci.c +++ b/tools/libxl/libxl_pci.c @@ -967,7 +967,7 @@ static int libxl__device_pci_reset(libxl__gc *gc, unsigned int domain, unsigned reset = libxl__sprintf(gc, "%s/pciback/do_flr", SYSFS_PCI_DEV); fd = open(reset, O_WRONLY); - if (fd > 0) { + if (fd >= 0) { char *buf = libxl__sprintf(gc, PCI_BDF, domain, bus, dev, func); rc = write(fd, buf, strlen(buf)); if (rc < 0)