author | zecke <zecke> | 2004-03-13 21:59:48 (UTC) |
---|---|---|
committer | zecke <zecke> | 2004-03-13 21:59:48 (UTC) |
commit | ee753c0009da5bec4a71d3263e9623d04dddc5c4 (patch) (unidiff) | |
tree | f578536203c4277cc124d622b50f46a025cbb3f9 /libopie2 | |
parent | 2eb5c075b612498c4b65f3d49389b8612612a930 (diff) | |
download | opie-ee753c0009da5bec4a71d3263e9623d04dddc5c4.zip opie-ee753c0009da5bec4a71d3263e9623d04dddc5c4.tar.gz opie-ee753c0009da5bec4a71d3263e9623d04dddc5c4.tar.bz2 |
Fix possible divide by null
Patch for mickeyl...
-rw-r--r-- | libopie2/opienet/onetwork.cpp | 21 |
1 files changed, 11 insertions, 10 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 | |||
@@ -54,25 +54,25 @@ | |||
54 | #include <linux/sockios.h> | 54 | #include <linux/sockios.h> |
55 | #include <net/if_arp.h> | 55 | #include <net/if_arp.h> |
56 | #include <stdarg.h> | 56 | #include <stdarg.h> |
57 | 57 | ||
58 | #ifndef NODEBUG | 58 | #ifndef NODEBUG |
59 | #include <opie2/odebugmapper.h> | 59 | #include <opie2/odebugmapper.h> |
60 | 60 | ||
61 | 61 | ||
62 | using namespace Opie::Core; | 62 | using namespace Opie::Core; |
63 | using namespace Opie::Net::Private; | 63 | using namespace Opie::Net::Private; |
64 | DebugMapper* debugmapper = new DebugMapper(); | 64 | DebugMapper* debugmapper = new DebugMapper(); |
65 | #endif | 65 | #endif |
66 | 66 | ||
67 | /*====================================================================================== | 67 | /*====================================================================================== |
68 | * ONetwork | 68 | * ONetwork |
69 | *======================================================================================*/ | 69 | *======================================================================================*/ |
70 | 70 | ||
71 | namespace Opie { | 71 | namespace Opie { |
72 | namespace Net { | 72 | namespace Net { |
73 | ONetwork* ONetwork::_instance = 0; | 73 | ONetwork* ONetwork::_instance = 0; |
74 | 74 | ||
75 | ONetwork::ONetwork() | 75 | ONetwork::ONetwork() |
76 | { | 76 | { |
77 | odebug << "ONetwork::ONetwork()" << oendl; | 77 | odebug << "ONetwork::ONetwork()" << oendl; |
78 | odebug << "ONetwork: This code has been compiled against Wireless Extensions V" << WIRELESS_EXT << oendl; | 78 | odebug << "ONetwork: This code has been compiled against Wireless Extensions V" << WIRELESS_EXT << oendl; |
@@ -1003,13 +1003,14 @@ int OWirelessNetworkInterface::signalStrength() const | |||
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 | ||
1013 | bool OWirelessNetworkInterface::wioctl( int call, struct iwreq& iwreq ) const | 1014 | bool OWirelessNetworkInterface::wioctl( int call, struct iwreq& iwreq ) const |
1014 | { | 1015 | { |
1015 | #ifndef NODEBUG | 1016 | #ifndef NODEBUG |
@@ -1240,9 +1241,9 @@ void OOrinocoMonitoringInterface::setEnabled( bool b ) | |||
1240 | 1241 | ||
1241 | 1242 | ||
1242 | QString OOrinocoMonitoringInterface::name() const | 1243 | QString OOrinocoMonitoringInterface::name() const |
1243 | { | 1244 | { |
1244 | return "orinoco"; | 1245 | return "orinoco"; |
1245 | } | 1246 | } |
1246 | 1247 | ||
1247 | } | 1248 | } |
1248 | } | 1249 | } |