author | mickeyl <mickeyl> | 2003-10-10 00:15:28 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2003-10-10 00:15:28 (UTC) |
commit | c1a897e63513c9647666970794c1684b2439501e (patch) (unidiff) | |
tree | 6787f5b1731238c7010937dca220e97f116f19b7 /libopie2 | |
parent | 802c9ab6b89fd10f709aa012e8ff075e9b4a5d7f (diff) | |
download | opie-c1a897e63513c9647666970794c1684b2439501e.zip opie-c1a897e63513c9647666970794c1684b2439501e.tar.gz opie-c1a897e63513c9647666970794c1684b2439501e.tar.bz2 |
Question: What's wrong in select(1, [], NULL, NULL, {100, 0} = 0 (timeout) ?
Answer: It would help to give select the correct filedescriptor...
/me hugs strace
-rw-r--r-- | libopie2/opienet/onetwork.cpp | 2 | ||||
-rw-r--r-- | libopie2/opienet/opcap.cpp | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/libopie2/opienet/onetwork.cpp b/libopie2/opienet/onetwork.cpp index 767651e..dc2e388 100644 --- a/libopie2/opienet/onetwork.cpp +++ b/libopie2/opienet/onetwork.cpp | |||
@@ -588,17 +588,17 @@ int OWirelessNetworkInterface::channel() const | |||
588 | { | 588 | { |
589 | return _channels[ static_cast<int>(double( _iwr.u.freq.m ) * pow( 10.0, _iwr.u.freq.e ) / 1000000) ]; | 589 | return _channels[ static_cast<int>(double( _iwr.u.freq.m ) * pow( 10.0, _iwr.u.freq.e ) / 1000000) ]; |
590 | } | 590 | } |
591 | } | 591 | } |
592 | 592 | ||
593 | 593 | ||
594 | void OWirelessNetworkInterface::setChannel( int c ) const | 594 | void OWirelessNetworkInterface::setChannel( int c ) const |
595 | { | 595 | { |
596 | if ( c ) | 596 | if ( !c ) |
597 | { | 597 | { |
598 | qWarning( "OWirelessNetworkInterface::setChannel( 0 ) called - fix your application!" ); | 598 | qWarning( "OWirelessNetworkInterface::setChannel( 0 ) called - fix your application!" ); |
599 | return; | 599 | return; |
600 | } | 600 | } |
601 | 601 | ||
602 | if ( !_mon ) | 602 | if ( !_mon ) |
603 | { | 603 | { |
604 | memset( &_iwr, 0, sizeof( struct iwreq ) ); | 604 | memset( &_iwr, 0, sizeof( struct iwreq ) ); |
diff --git a/libopie2/opienet/opcap.cpp b/libopie2/opienet/opcap.cpp index 38ca1a1..6331b2d 100644 --- a/libopie2/opienet/opcap.cpp +++ b/libopie2/opienet/opcap.cpp | |||
@@ -1138,17 +1138,17 @@ int OPacketCapturer::fileno() const | |||
1138 | OPacket* OPacketCapturer::next( int time ) | 1138 | OPacket* OPacketCapturer::next( int time ) |
1139 | { | 1139 | { |
1140 | fd_set fds; | 1140 | fd_set fds; |
1141 | struct timeval tv; | 1141 | struct timeval tv; |
1142 | FD_ZERO( &fds ); | 1142 | FD_ZERO( &fds ); |
1143 | FD_SET( pcap_fileno( _pch ), &fds ); | 1143 | FD_SET( pcap_fileno( _pch ), &fds ); |
1144 | tv.tv_sec = time / 1000; | 1144 | tv.tv_sec = time / 1000; |
1145 | tv.tv_usec = time % 1000; | 1145 | tv.tv_usec = time % 1000; |
1146 | int retval = select( 1, &fds, NULL, NULL, &tv); | 1146 | int retval = select( pcap_fileno( _pch )+1, &fds, NULL, NULL, &tv); |
1147 | if ( retval > 0 ) // clear to read! | 1147 | if ( retval > 0 ) // clear to read! |
1148 | return next(); | 1148 | return next(); |
1149 | else | 1149 | else |
1150 | return 0; | 1150 | return 0; |
1151 | } | 1151 | } |
1152 | 1152 | ||
1153 | 1153 | ||
1154 | OPacket* OPacketCapturer::next() | 1154 | OPacket* OPacketCapturer::next() |