summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--libopie2/opienet/onetwork.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/libopie2/opienet/onetwork.cpp b/libopie2/opienet/onetwork.cpp
index ab3e77f..26a6c81 100644
--- a/libopie2/opienet/onetwork.cpp
+++ b/libopie2/opienet/onetwork.cpp
@@ -997,25 +997,26 @@ int OWirelessNetworkInterface::signalStrength() const
997 _iwr.u.data.length = sizeof stat; 997 _iwr.u.data.length = sizeof stat;
998 998
999 if ( !wioctl( SIOCGIWSTATS ) ) 999 if ( !wioctl( SIOCGIWSTATS ) )
1000 { 1000 {
1001 return -1; 1001 return -1;
1002 } 1002 }
1003 1003
1004 int max = _range.max_qual.qual; 1004 int max = _range.max_qual.qual;
1005 int cur = stat.qual.qual; 1005 int cur = stat.qual.qual;
1006 int lev = stat.qual.level; //FIXME: Do something with them? 1006 int lev = stat.qual.level; //FIXME: Do something with them?
1007 int noi = stat.qual.noise; //FIXME: Do something with them? 1007 int noi = stat.qual.noise; //FIXME: Do something with them?
1008 1008
1009 return cur*100/max; 1009
1010 return max != 0 ? cur*100/max: -1;
1010} 1011}
1011 1012
1012 1013
1013bool OWirelessNetworkInterface::wioctl( int call, struct iwreq& iwreq ) const 1014bool OWirelessNetworkInterface::wioctl( int call, struct iwreq& iwreq ) const
1014{ 1015{
1015 #ifndef NODEBUG 1016 #ifndef NODEBUG
1016 int result = ::ioctl( _sfd, call, &iwreq ); 1017 int result = ::ioctl( _sfd, call, &iwreq );
1017 1018
1018 if ( result == -1 ) 1019 if ( result == -1 )
1019 odebug << "ONetworkInterface::wioctl (" << name() << ") call '" 1020 odebug << "ONetworkInterface::wioctl (" << name() << ") call '"
1020 << debugmapper->map( call ) << "' FAILED! " << result << " (" << strerror( errno ) << ")" << oendl; 1021 << debugmapper->map( call ) << "' FAILED! " << result << " (" << strerror( errno ) << ")" << oendl;
1021 else 1022 else