libsimpleio: (reinhard) bugfix; set flags for fd also when passed to the constructor.
authorReinhard Pfau <reinhard.pfau@intra2net.com>
Fri, 10 Oct 2008 12:51:26 +0000 (12:51 +0000)
committerReinhard Pfau <reinhard.pfau@intra2net.com>
Fri, 10 Oct 2008 12:51:26 +0000 (12:51 +0000)
simpleio/simpleio.cpp

index 53ed78f..9bf0cad 100644 (file)
@@ -677,8 +677,8 @@ void FilterBase::reset()
  * @param write_fd  the file descriptor which should be used for writing (default -1 for no value)
  */
 IOImplementation::IOImplementation(int read_fd, int write_fd)
-: m_read_fd(read_fd)
-, m_write_fd(write_fd)
+: m_read_fd(-1)
+, m_write_fd(-1)
 , m_eof(false)
 , m_not_writable(false)
 , m_input_buffer()
@@ -687,6 +687,14 @@ IOImplementation::IOImplementation(int read_fd, int write_fd)
 , m_marked_for_writing(false)
 {
     internal_io::g_io_list().add_item(this);
+    if (read_fd >= 0)
+    {
+        setReadFd( read_fd );
+    }
+    if (write_fd >= 0)
+    {
+        setWriteFd( write_fd );
+    }
 } // eo IOImplementation::IOImplementation