Skip to content
Snippets Groups Projects
Commit d8a75b74 authored by Guillaume Valadon's avatar Guillaume Valadon
Browse files

Catch IOError exception

--HG--
branch : Issue #5061
parent e697a8ab
No related branches found
No related tags found
No related merge requests found
...@@ -89,7 +89,11 @@ def get_if_raw_addr(iff): ...@@ -89,7 +89,11 @@ def get_if_raw_addr(iff):
def get_if_list(): def get_if_list():
f=open("/proc/net/dev","r") try:
f=open("/proc/net/dev","r")
except IOError:
warning("Can't open /proc/net/dev !")
return []
lst = [] lst = []
f.readline() f.readline()
f.readline() f.readline()
...@@ -145,7 +149,11 @@ def set_promisc(s,iff,val=1): ...@@ -145,7 +149,11 @@ def set_promisc(s,iff,val=1):
def read_routes(): def read_routes():
f=open("/proc/net/route","r") try:
f=open("/proc/net/route","r")
except IOError:
warning("Can't open /proc/net/route !")
return []
routes = [] routes = []
s=socket.socket(socket.AF_INET, socket.SOCK_DGRAM) s=socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
ifreq = ioctl(s, SIOCGIFADDR,struct.pack("16s16x",LOOPBACK_NAME)) ifreq = ioctl(s, SIOCGIFADDR,struct.pack("16s16x",LOOPBACK_NAME))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment