summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2019-12-30 15:45:41 +0100
committerChristian Poessinger <christian@poessinger.com>2019-12-30 15:45:41 +0100
commit9436b433df3f10260a4802b51f6259424fb986dc (patch)
tree650d7abf619ba97ca0b3778d38e93869880488ce
parent9b1cfeff18a23dfbefd485741ac4609c92707dfd (diff)
downloadvyos-1x-9436b433df3f10260a4802b51f6259424fb986dc.tar.gz
vyos-1x-9436b433df3f10260a4802b51f6259424fb986dc.zip
options: T1919: check file existance before os.unlink()
-rwxr-xr-xsrc/conf_mode/system-options.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/conf_mode/system-options.py b/src/conf_mode/system-options.py
index 74c34e19f..a893e98b3 100755
--- a/src/conf_mode/system-options.py
+++ b/src/conf_mode/system-options.py
@@ -57,7 +57,8 @@ def apply(opt):
# Ctrl-Alt-Delete action
if opt['ctrl_alt_del'] == 'ignore':
- os.unlink('/lib/systemd/system/ctrl-alt-del.target')
+ if os.path.exists(systemd_ctrl_alt_del):
+ os.unlink('/lib/systemd/system/ctrl-alt-del.target')
elif opt['ctrl_alt_del'] == 'reboot':
if os.path.exists(systemd_ctrl_alt_del):