From: Robert Roebling Date: Tue, 14 Mar 2000 13:53:34 +0000 (+0000) Subject: Even more printfs in GSocket, X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/a8a0b892dfcd7945637511f94f1dec0ddd81dfa4 Even more printfs in GSocket, Copmile fix for splitter. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@6683 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/generic/splitter.cpp b/src/generic/splitter.cpp index 60ffc6dc72..f806238232 100644 --- a/src/generic/splitter.cpp +++ b/src/generic/splitter.cpp @@ -32,6 +32,7 @@ #include "wx/splitter.h" #include "wx/dcscreen.h" #include "wx/settings.h" +#include "wx/log.h" IMPLEMENT_DYNAMIC_CLASS(wxSplitterWindow, wxWindow) IMPLEMENT_DYNAMIC_CLASS(wxSplitterEvent, wxCommandEvent) diff --git a/src/unix/gsocket.c b/src/unix/gsocket.c index f7f2b1ef04..65e16aa68c 100644 --- a/src/unix/gsocket.c +++ b/src/unix/gsocket.c @@ -915,6 +915,7 @@ GSocketError _GSocket_Input_Timeout(GSocket *socket) { struct timeval tv; fd_set readfds; + int ret; /* Linux select() will overwrite the struct on return */ tv.tv_sec = (socket->m_timeout / 1000); @@ -924,8 +925,20 @@ GSocketError _GSocket_Input_Timeout(GSocket *socket) { FD_ZERO(&readfds); FD_SET(socket->m_fd, &readfds); - if (select(socket->m_fd + 1, &readfds, NULL, NULL, &tv) == 0) + ret = select(socket->m_fd + 1, &readfds, NULL, NULL, &tv); + if (ret == 0) + { + printf( "GSocket_Input_Timeout, select returned 0\n" ); + socket->m_error = GSOCK_TIMEDOUT; + return GSOCK_TIMEDOUT; + } + if (ret == -1) { + printf( "GSocket_Input_Timeout, select returned -1\n" ); + if (errno == EBADF) printf( "Invalid file descriptor\n" ); + if (errno == EINTR) printf( "A non blocked signal was caught\n" ); + if (errno == EINVAL) printf( "The highest number descriptor is negative\n" ); + if (errno == ENOMEM) printf( "Not enough memory\n" ); socket->m_error = GSOCK_TIMEDOUT; return GSOCK_TIMEDOUT; } @@ -941,6 +954,7 @@ GSocketError _GSocket_Output_Timeout(GSocket *socket) { struct timeval tv; fd_set writefds; + int ret; /* Linux select() will overwrite the struct on return */ tv.tv_sec = (socket->m_timeout / 1000); @@ -950,8 +964,20 @@ GSocketError _GSocket_Output_Timeout(GSocket *socket) { FD_ZERO(&writefds); FD_SET(socket->m_fd, &writefds); - if (select(socket->m_fd + 1, NULL, &writefds, NULL, &tv) == 0) + ret = select(socket->m_fd + 1, NULL, &writefds, NULL, &tv); + if (ret == 0) + { + printf( "GSocket_Output_Timeout, select returned 0\n" ); + socket->m_error = GSOCK_TIMEDOUT; + return GSOCK_TIMEDOUT; + } + if (ret == -1) { + printf( "GSocket_Output_Timeout, select returned -1\n" ); + if (errno == EBADF) printf( "Invalid file descriptor\n" ); + if (errno == EINTR) printf( "A non blocked signal was caught\n" ); + if (errno == EINVAL) printf( "The highest number descriptor is negative\n" ); + if (errno == ENOMEM) printf( "Not enough memory\n" ); socket->m_error = GSOCK_TIMEDOUT; return GSOCK_TIMEDOUT; }