]> git.saurik.com Git - wxWidgets.git/blobdiff - src/unix/gsocket.cpp
dialog creation function should be extern C
[wxWidgets.git] / src / unix / gsocket.cpp
index ab459eb018c6f7bc111dca21d7df46a4318a2954..cef26902b31dfd6615c668a33ca9a8eba7bdffd1 100644 (file)
 #endif
 
 #ifndef __GSOCKET_STANDALONE__
-#include "wx/setup.h"
+#include "wx/defs.h"
 #endif
 
 #if defined(__VISAGECPP__)
-/* Seems to be needed by Visual Age C++, though I don't see how it manages
-   to not break on including a C++ header into a plain C source file      */
-#include "wx/defs.h"
 #define BSD_SELECT /* use Berkley Sockets select */
 #endif
 
@@ -162,12 +159,11 @@ int _System soclose(int);
     #define UNMASK_SIGNAL() }
 
 #else
+    extern "C" { typedef void (*wxSigHandler)(int); }
 
     #define MASK_SIGNAL()                       \
     {                                           \
-        void (*old_handler)(int);               \
-                                                \
-        old_handler = signal(SIGPIPE, SIG_IGN);
+        wxSigHandler old_handler = signal(SIGPIPE, SIG_IGN);
 
     #define UNMASK_SIGNAL()                     \
         signal(SIGPIPE, old_handler);           \
@@ -969,6 +965,9 @@ GSocketEventFlags GSocket::Select(GSocketEventFlags flags)
 
     assert(this);
 
+    if (m_fd == -1)
+        return (GSOCK_LOST_FLAG & flags);
+    
     /* Do not use a static struct, Linux can garble it */
     tv.tv_sec = m_timeout / 1000;
     tv.tv_usec = (m_timeout % 1000) * 1000;