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>
This commit is contained in:
Martin Ettl 2009-10-08 13:27:30 +11:00 • committed by Daniel Stone
commit 4df3e8c805
3 changed files with 5 additions and 5 deletions

View file

@ -253,7 +253,7 @@ configureInputSection (void)
int fd;
#ifdef WSCONS_SUPPORT
fd = open("/dev/wsmouse", 0);
if (fd > 0) {
if (fd >= 0) {
DFLT_MOUSE_DEV = "/dev/wsmouse";
DFLT_MOUSE_PROTO = "wsmouse";
close(fd);