fd == 0 fix from Vsevolod Lobko
diff --git a/pyserial/CHANGES.txt b/pyserial/CHANGES.txt
index 7d8d84a..3b8c4b1 100644
--- a/pyserial/CHANGES.txt
+++ b/pyserial/CHANGES.txt
@@ -134,3 +134,7 @@
 
 Version 2.0      6 Nov 2003
     - Fixes setup.py for older distutils
+
+Version 2.1     XXXXXXXXXXX
+    Bugfixes (posix):
+    - fd == 0 fix from Vsevolod Lobko
diff --git a/pyserial/serial/serialposix.py b/pyserial/serial/serialposix.py
index aa3b562..30e1eab 100644
--- a/pyserial/serial/serialposix.py
+++ b/pyserial/serial/serialposix.py
@@ -13,7 +13,7 @@
 import sys, os, fcntl, termios, struct, select
 from serialutil import *
 
-VERSION = "$Revision: 1.19 $".split()[1]     #extract CVS version
+VERSION = "$Revision: 1.20 $".split()[1]     #extract CVS version
 
 #Do check the Python version as some constants have moved.
 if (sys.hexversion < 0x020100f0):
@@ -152,7 +152,7 @@
         
     def _reconfigurePort(self):
         """Set commuication parameters on opened port."""
-        if not self.fd:
+        if self.fd is None:
             raise SerialException("Can only operate on a valid port handle")
             
         vmin = vtime = 0                #timeout is done via select
@@ -244,7 +244,7 @@
     def close(self):
         """Close port"""
         if self._isOpen:
-            if self.fd:
+            if self.fd is not None:
                 os.close(self.fd)
                 self.fd = None
             self._isOpen = False
@@ -264,7 +264,7 @@
         """Read size bytes from the serial port. If a timeout is set it may
            return less characters as requested. With no timeout it will block
            until the requested number of bytes is read."""
-        if not self.fd: raise portNotOpenError
+        if self.fd is None: raise portNotOpenError
         read = ''
         inp = None
         if size > 0:
@@ -281,10 +281,10 @@
 
     def write(self, data):
         """Output the given string over the serial port."""
-        if not self.fd: raise portNotOpenError
+        if self.fd is None: raise portNotOpenError
         t = len(data)
         d = data
-        while t>0:
+        while t > 0:
             n = os.write(self.fd, d)
             d = d[n:]
             t = t - n
@@ -296,26 +296,26 @@
 
     def flushInput(self):
         """Clear input buffer, discarding all that is in the buffer."""
-        if not self.fd:
+        if self.fd is None:
             raise portNotOpenError
         termios.tcflush(self.fd, TERMIOS.TCIFLUSH)
 
     def flushOutput(self):
         """Clear output buffer, aborting the current output and
         discarding all that is in the buffer."""
-        if not self.fd:
+        if self.fd is None:
             raise portNotOpenError
         termios.tcflush(self.fd, TERMIOS.TCOFLUSH)
 
     def sendBreak(self):
         """Send break condition."""
-        if not self.fd:
+        if self.fd is None:
             raise portNotOpenError
         termios.tcsendbreak(self.fd, 0)
 
     def setRTS(self,on=1):
         """Set terminal status line: Request To Send"""
-        if not self.fd: raise portNotOpenError
+        if self.fd is None: raise portNotOpenError
         if on:
             fcntl.ioctl(self.fd, TIOCMBIS, TIOCM_RTS_str)
         else:
@@ -323,7 +323,7 @@
 
     def setDTR(self,on=1):
         """Set terminal status line: Data Terminal Ready"""
-        if not self.fd: raise portNotOpenError
+        if self.fd is None: raise portNotOpenError
         if on:
             fcntl.ioctl(self.fd, TIOCMBIS, TIOCM_DTR_str)
         else:
@@ -331,25 +331,25 @@
 
     def getCTS(self):
         """Read terminal status line: Clear To Send"""
-        if not self.fd: raise portNotOpenError
+        if self.fd is None: raise portNotOpenError
         s = fcntl.ioctl(self.fd, TIOCMGET, TIOCM_zero_str)
         return struct.unpack('I',s)[0] & TIOCM_CTS != 0
 
     def getDSR(self):
         """Read terminal status line: Data Set Ready"""
-        if not self.fd: raise portNotOpenError
+        if self.fd is None: raise portNotOpenError
         s = fcntl.ioctl(self.fd, TIOCMGET, TIOCM_zero_str)
         return struct.unpack('I',s)[0] & TIOCM_DSR != 0
 
     def getRI(self):
         """Read terminal status line: Ring Indicator"""
-        if not self.fd: raise portNotOpenError
+        if self.fd is None: raise portNotOpenError
         s = fcntl.ioctl(self.fd, TIOCMGET, TIOCM_zero_str)
         return struct.unpack('I',s)[0] & TIOCM_RI != 0
 
     def getCD(self):
         """Read terminal status line: Carrier Detect"""
-        if not self.fd: raise portNotOpenError
+        if self.fd is None: raise portNotOpenError
         s = fcntl.ioctl(self.fd, TIOCMGET, TIOCM_zero_str)
         return struct.unpack('I',s)[0] & TIOCM_CD != 0
 
@@ -357,12 +357,12 @@
 
     def drainOutput(self):
         """internal - not portable!"""
-        if not self.fd: raise portNotOpenError
+        if self.fd is None: raise portNotOpenError
         termios.tcdrain(self.fd)
 
     def nonblocking(self):
         """internal - not portable!"""
-        if not self.fd:
+        if self.fd is None:
             raise portNotOpenError
         fcntl.fcntl(self.fd, FCNTL.F_SETFL, FCNTL.O_NONBLOCK)