Browse Source

Bugfix: lowl-vcom: Invalid fd checks should be for -1, not 0

Luke Dashjr 12 years ago
parent
commit
cd890dd472
1 changed files with 3 additions and 3 deletions
  1. 3 3
      fpgautils.c

+ 3 - 3
fpgautils.c

@@ -1352,7 +1352,7 @@ int get_serial_cts(int fd)
 {
 {
 	int flags;
 	int flags;
 
 
-	if (!fd)
+	if (fd == -1)
 		return -1;
 		return -1;
 
 
 	ioctl(fd, TIOCMGET, &flags);
 	ioctl(fd, TIOCMGET, &flags);
@@ -1363,7 +1363,7 @@ int set_serial_rts(int fd, int rts)
 {
 {
 	int flags;
 	int flags;
 
 
-	if (!fd)
+	if (fd == -1)
 		return -1;
 		return -1;
 
 
 	ioctl(fd, TIOCMGET, &flags);
 	ioctl(fd, TIOCMGET, &flags);
@@ -1379,7 +1379,7 @@ int set_serial_rts(int fd, int rts)
 #else
 #else
 int get_serial_cts(const int fd)
 int get_serial_cts(const int fd)
 {
 {
-	if (!fd)
+	if (fd == -1)
 		return -1;
 		return -1;
 	const HANDLE fh = (HANDLE)_get_osfhandle(fd);
 	const HANDLE fh = (HANDLE)_get_osfhandle(fd);
 	if (!fh)
 	if (!fh)