summaryrefslogtreecommitdiff
path: root/hw/kdrive
diff options
context:
space:
mode:
authorMartin Ettl <ettl.martin@gmx.de>2009-10-08 13:27:30 +1100
committerDaniel Stone <daniel@fooishbar.org>2009-10-08 13:27:30 +1100
commit4df3e8c8053d9d4b3043f339a73d0de97020d884 (patch)
treef7444e06c461491996bf146f4320ccfbd523ee53 /hw/kdrive
parent4151a13c80f3afa43f88afcf19a7aeb16dace93a (diff)
Resource leakage: 0 is a valid file descriptor
When testing if an fd is valid, the required construct is >= 0, not > 0. [Daniel: Fixed up the Linux MTRR case as well.] Signed-off-by: Martin Ettl <ettl.martin@gmx.de> Signed-off-by: Daniel Stone <daniel@fooishbar.org>
Diffstat (limited to 'hw/kdrive')
-rw-r--r--hw/kdrive/linux/bus.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/hw/kdrive/linux/bus.c b/hw/kdrive/linux/bus.c
index ba8a6cd43..93c3ea5f3 100644
--- a/hw/kdrive/linux/bus.c
+++ b/hw/kdrive/linux/bus.c
@@ -72,7 +72,7 @@ BusInit (KdPointerInfo *pi)
{
for (i = 0; i < NUM_BUS_NAMES; i++)
{
- if ((fd = open (BusNames[i], 0)) > 0)
+ if ((fd = open (BusNames[i], 0)) >= 0)
{
close(fd);
if (pi->path)
@@ -84,7 +84,7 @@ BusInit (KdPointerInfo *pi)
}
else
{
- if ((fd = open(pi->path, 0)) > 0)
+ if ((fd = open(pi->path, 0)) >= 0)
{
close(fd);
return Success;
@@ -99,7 +99,7 @@ BusEnable (KdPointerInfo *pi)
{
int fd = open(pi->path, 0);
- if (fd > 0)
+ if (fd >= 0)
{
KdRegisterFd(fd, BusRead, pi);
pi->driverPrivate = (void *)fd;