live: keep $PATH and $DISPLAY

pull/249/head
Robert Schütz 2020-04-06 11:22:16 +02:00 committed by Benjamin Tissoires
parent 7a881de9bb
commit 72d9dee37a
1 changed files with 4 additions and 0 deletions

View File

@ -183,11 +183,15 @@ def drop_privileges():
os.setresuid(uid, uid, uid)
pw = pwd.getpwuid(uid)
path = os.environ['PATH']
display = os.environ['DISPLAY']
# we completely clear the environment and start a new and controlled one
os.environ.clear()
os.environ['XDG_RUNTIME_DIR'] = f'/run/user/{uid}'
os.environ['HOME'] = pw.pw_dir
os.environ['PATH'] = path
os.environ['DISPLAY'] = display
def parse(args):