Catch IOError exception

--HG--
branch : Issue #5061
This commit is contained in:
Guillaume Valadon 2013-10-28 11:37:16 +01:00
parent e697a8ab40
commit d8a75b744a
1 changed files with 10 additions and 2 deletions

View File

@ -89,7 +89,11 @@ def get_if_raw_addr(iff):
def get_if_list():
try:
f=open("/proc/net/dev","r")
except IOError:
warning("Can't open /proc/net/dev !")
return []
lst = []
f.readline()
f.readline()
@ -145,7 +149,11 @@ def set_promisc(s,iff,val=1):
def read_routes():
try:
f=open("/proc/net/route","r")
except IOError:
warning("Can't open /proc/net/route !")
return []
routes = []
s=socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
ifreq = ioctl(s, SIOCGIFADDR,struct.pack("16s16x",LOOPBACK_NAME))