changeset 35218:03021b062140

Fix more places that incorrectly assume that 0 can never be a valid file descriptor.
author reimar
date Wed, 31 Oct 2012 19:50:11 +0000
parents c45cbe0d8ce1
children f46a80e9fe77
files vidix/sysdep/pci_linux.c
diffstat 1 files changed, 5 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/vidix/sysdep/pci_linux.c	Wed Oct 31 19:47:15 2012 +0000
+++ b/vidix/sysdep/pci_linux.c	Wed Oct 31 19:50:11 2012 +0000
@@ -43,7 +43,7 @@
 #ifdef CONFIG_DHAHELPER
 #include <fcntl.h>
 int dhahelper_initialized = 0;
-int dhahelper_fd = 0;
+int dhahelper_fd = -1;
 #endif
 
 #ifdef CONFIG_SVGAHELPER
@@ -55,7 +55,7 @@
 #define SVGALIB_HELPER_IOCGPCIINL SVGAHELPER_PCIINL
 #endif
 int svgahelper_initialized = 0;
-int svgahelper_fd = 0;
+int svgahelper_fd = -1;
 
 static int pci_config_type(void)
 {
@@ -92,7 +92,7 @@
 {
 #ifdef CONFIG_SVGAHELPER
     svgahelper_fd = open(DEV_SVGA, O_RDWR);
-    if (svgahelper_fd > 0)
+    if (svgahelper_fd != -1)
     {
 	svgahelper_initialized = 1;
 	return 0;
@@ -102,7 +102,7 @@
 
 #ifdef CONFIG_DHAHELPER
     dhahelper_fd = open("/dev/dhahelper", O_RDWR);
-    if (dhahelper_fd > 0)
+    if (dhahelper_fd != -1)
     {
 	dhahelper_initialized = 1;
 	return 0;
@@ -205,7 +205,7 @@
     } else {
 	    retval = 0;
     }
-    if (fd > 0) {
+    if (fd != -1) {
 	    close(fd);
     }
     return retval;