diff --git a/src/examples/ntester.cc b/src/examples/ntester.cc index 4fc7404..97ad9c1 100644 --- a/src/examples/ntester.cc +++ b/src/examples/ntester.cc @@ -153,10 +153,6 @@ int main( int argc, char *argv[] ) /* we only read one socket each run */ network_ready_to_read = true; } - - if ( sel.error( *it ) ) { - break; - } } if ( network_ready_to_read ) { diff --git a/src/examples/parse.cc b/src/examples/parse.cc index f9f72bf..56aa171 100644 --- a/src/examples/parse.cc +++ b/src/examples/parse.cc @@ -158,8 +158,6 @@ static void emulate_terminal( int fd ) if ( vt_parser( fd, &parser ) < 0 ) { return; } - } else if ( sel.error( STDIN_FILENO ) || sel.error( fd ) ) { - return; } else { fprintf( stderr, "select mysteriously woken up\n" ); } diff --git a/src/examples/termemu.cc b/src/examples/termemu.cc index 5704408..a29c73a 100644 --- a/src/examples/termemu.cc +++ b/src/examples/termemu.cc @@ -311,8 +311,6 @@ static void emulate_terminal( int fd ) perror( "ioctl TIOCSWINSZ" ); return; } - } else if ( sel.error( STDIN_FILENO ) || sel.error( fd ) ) { - break; } Terminal::Framebuffer new_frame( complete.get_fb() ); diff --git a/src/frontend/mosh-server.cc b/src/frontend/mosh-server.cc index 45e4215..28480ce 100644 --- a/src/frontend/mosh-server.cc +++ b/src/frontend/mosh-server.cc @@ -765,16 +765,6 @@ static void serve( int host_fd, Terminal::Complete &terminal, ServerConnection & } } - if ( sel.error( network_fd ) ) { - /* network problem */ - break; - } - - if ( (!network.shutdown_in_progress()) && sel.error( host_fd ) ) { - /* host problem */ - network.start_shutdown(); - } - /* quit if our shutdown has been acknowledged */ if ( network.shutdown_in_progress() && network.shutdown_acknowledged() ) { break; diff --git a/src/frontend/stmclient.cc b/src/frontend/stmclient.cc index e034907..78c5625 100644 --- a/src/frontend/stmclient.cc +++ b/src/frontend/stmclient.cc @@ -448,11 +448,6 @@ bool STMClient::main( void ) /* we only read one socket each run */ network_ready_to_read = true; } - - if ( sel.error( *it ) ) { - /* network problem */ - break; - } } if ( network_ready_to_read ) { @@ -493,16 +488,6 @@ bool STMClient::main( void ) } } - if ( sel.error( STDIN_FILENO ) ) { - /* user problem */ - if ( !network->has_remote_addr() ) { - break; - } else if ( !network->shutdown_in_progress() ) { - overlays.get_notification_engine().set_notification_string( wstring( L"Exiting..." ), true ); - network->start_shutdown(); - } - } - /* quit if our shutdown has been acknowledged */ if ( network->shutdown_in_progress() && network->shutdown_acknowledged() ) { clean_shutdown = true; diff --git a/src/util/select.h b/src/util/select.h index ca8a2de..4b4834b 100644 --- a/src/util/select.h +++ b/src/util/select.h @@ -62,12 +62,10 @@ private: here to appease -Weffc++. */ , all_fds( dummy_fd_set ) , read_fds( dummy_fd_set ) - , error_fds( dummy_fd_set ) , empty_sigset( dummy_sigset ) { FD_ZERO( &all_fds ); FD_ZERO( &read_fds ); - FD_ZERO( &error_fds ); clear_got_signal(); fatal_assert( 0 == sigemptyset( &empty_sigset ) ); @@ -120,7 +118,6 @@ public: int select( int timeout ) { memcpy( &read_fds, &all_fds, sizeof( read_fds ) ); - memcpy( &error_fds, &all_fds, sizeof( error_fds ) ); clear_got_signal(); #ifdef HAVE_PSELECT @@ -133,7 +130,7 @@ public: tsp = &ts; } - int ret = ::pselect( max_fd + 1, &read_fds, NULL, &error_fds, tsp, &empty_sigset ); + int ret = ::pselect( max_fd + 1, &read_fds, NULL, NULL, tsp, &empty_sigset ); #else struct timeval tv; struct timeval *tvp = NULL; @@ -147,7 +144,7 @@ public: int ret = sigprocmask( SIG_SETMASK, &empty_sigset, &old_sigset ); if ( ret != -1 ) { - ret = ::select( max_fd + 1, &read_fds, NULL, &error_fds, tvp ); + ret = ::select( max_fd + 1, &read_fds, NULL, NULL, tvp ); sigprocmask( SIG_SETMASK, &old_sigset, NULL ); } #endif @@ -155,7 +152,6 @@ public: if ( ( ret == -1 ) && ( errno == EINTR ) ) { /* The user should process events as usual. */ FD_ZERO( &read_fds ); - FD_ZERO( &error_fds ); ret = 0; } @@ -173,15 +169,6 @@ public: return FD_ISSET( fd, &read_fds ); } - bool error( int fd ) -#if FD_ISSET_IS_CONST - const -#endif - { - assert( FD_ISSET( fd, &all_fds ) ); - return FD_ISSET( fd, &error_fds ); - } - /* This method consumes a signal notification. */ bool signal( int signum ) { @@ -214,7 +201,7 @@ private: concurrent signal handlers. */ int got_signal[ MAX_SIGNAL_NUMBER + 1 ]; - fd_set all_fds, read_fds, error_fds; + fd_set all_fds, read_fds; sigset_t empty_sigset;