# HG changeset patch # User reimar # Date 1351713011 0 # Node ID 03021b062140570f002a68ff31452fefa10dcdcd # Parent c45cbe0d8ce10d473af9e202036614046c2e091f Fix more places that incorrectly assume that 0 can never be a valid file descriptor. diff -r c45cbe0d8ce1 -r 03021b062140 vidix/sysdep/pci_linux.c --- 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 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;