From mboxrd@z Thu Jan 1 00:00:00 1970 From: Matthew Daley Subject: [PATCH 15/29] libxl: correct file open success check in libxl__device_pci_reset Date: Wed, 30 Oct 2013 20:51:51 +1300 Message-ID: <1383119525-26033-16-git-send-email-mattjd@gmail.com> References: <1383119525-26033-1-git-send-email-mattjd@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1383119525-26033-1-git-send-email-mattjd@gmail.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel@lists.xen.org Cc: Matthew Daley , Ian Jackson , Ian Campbell , Stefano Stabellini List-Id: xen-devel@lists.xenproject.org It could, even if only in theory, be fd 0. Coverity-ID: 1055895 Signed-off-by: Matthew Daley --- tools/libxl/libxl_pci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/libxl/libxl_pci.c b/tools/libxl/libxl_pci.c index b9960bb..26ba3e6 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) -- 1.7.10.4