Menu

#11 g-n-m crash on startup if haven't found syslog_rc

open
nobody
None
5
2008-02-28
2008-02-28
No

Problem is in line 211 of iptables.py where if operation:
syslog_rc = open(self.__config["syslog_rc"])
haven't succeded, exception is cought and message
print _("Could not open syslog config file....")
is printed, but there is no return or break statment and program continue to run and crushes shortly.

This is the message when starting /usr/bin/gnome-network-monitor
----------------------------------------------
Could not open syslog config file....
Traceback (most recent call last):
File "/usr/sbin/gnome-network-monitor", line 10, in <module>
gnm.run()
File "/usr/lib/python2.5/site-packages/gnome-network-monitor/gnm.py", line 141, in run
MainWindow()
File "/usr/lib/python2.5/site-packages/gnome-network-monitor/gnm.py", line 100, in __init__
self.__iptables = LogAnalyzer(logs.find_log_targets(), self.__config["iptables"])
File "/usr/lib/python2.5/site-packages/gnome-network-monitor/iptables.py", line 246, in find_log_targets
victims.extend(self.__check_syslog())
File "/usr/lib/python2.5/site-packages/gnome-network-monitor/iptables.py", line 214, in __check_syslog
for line in syslog_rc:
UnboundLocalError: local variable 'syslog_rc' referenced before assignment
----------------------------------------------

------Code now is:------
try:
syslog_rc = open(self.__config["syslog_rc"])
except: print _("Could not open syslog config file....")

------Should be:------
try:
syslog_rc = open(self.__config["syslog_rc"])
except:
print _("Could not open syslog config file....")
return list()

or something simmilar, to stop using not set variable syslog_rc after exception.

------
System: Fedora 8
from RPM: gnome-network-monitor-0.9.1-4.fc8.noarch.rpm
Linux 2.6.23.15-137.fc8 #1 SMP Sun Feb 10 17:03:13 EST 2008 x86_64 x86_64 x86_64 GNU/Linux

Jan S

Discussion


Log in to post a comment.

MongoDB Logo MongoDB