1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-06 04:31:29 +00:00

Avoid crashing if we can't write to zenmap.conf. Fixes #449

This commit is contained in:
dmiller
2016-08-31 15:21:23 +00:00
parent 2cf41557eb
commit fd37e977c9
2 changed files with 33 additions and 4 deletions

View File

@@ -124,6 +124,7 @@ import gtk
import sys
import os
from os.path import split, isfile, join, abspath, exists
import errno
# Prevent loading PyXML
import xml
@@ -905,9 +906,23 @@ This scan has not been run yet. Start the scan with the "Scan" button first.'))
return True
window = WindowConfig()
window.x, window.y = self.get_position()
window.width, window.height = self.get_size()
window.save_changes()
try:
window.x, window.y = self.get_position()
window.width, window.height = self.get_size()
window.save_changes()
except IOError as e:
if e.errno == errno.EACCES:
alert = HIGAlertDialog(
message_format=_("Can't save Zenmap configuration"),
# newline before path to help avoid weird line wrapping
secondary_text=_(
'Permission denied when writing to\n%s'
'\nMake sure the file exists and is writable.'
) % (Path.user_config_file))
alert.run()
alert.destroy()
else:
raise
self.destroy()