author | mickeyl <mickeyl> | 2003-10-10 00:15:28 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2003-10-10 00:15:28 (UTC) |
commit | c1a897e63513c9647666970794c1684b2439501e (patch) (side-by-side diff) | |
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 @@ -584,25 +584,25 @@ int OWirelessNetworkInterface::channel() const { return -1; } else { return _channels[ static_cast<int>(double( _iwr.u.freq.m ) * pow( 10.0, _iwr.u.freq.e ) / 1000000) ]; } } void OWirelessNetworkInterface::setChannel( int c ) const { - if ( c ) + if ( !c ) { qWarning( "OWirelessNetworkInterface::setChannel( 0 ) called - fix your application!" ); return; } if ( !_mon ) { memset( &_iwr, 0, sizeof( struct iwreq ) ); _iwr.u.freq.m = c; _iwr.u.freq.e = 0; wioctl( SIOCSIWFREQ ); } 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 @@ -1134,25 +1134,25 @@ int OPacketCapturer::fileno() const } } OPacket* OPacketCapturer::next( int time ) { fd_set fds; struct timeval tv; FD_ZERO( &fds ); FD_SET( pcap_fileno( _pch ), &fds ); tv.tv_sec = time / 1000; tv.tv_usec = time % 1000; - int retval = select( 1, &fds, NULL, NULL, &tv); + int retval = select( pcap_fileno( _pch )+1, &fds, NULL, NULL, &tv); if ( retval > 0 ) // clear to read! return next(); else return 0; } OPacket* OPacketCapturer::next() { packetheaderstruct header; qDebug( "==> OPacketCapturer::next()" ); const unsigned char* pdata = pcap_next( _pch, &header ); |