We just don't set the HOME env variable in that case.
Change-Id: Ieab00d21d61e7e001dc3c04ef1d618e9d8c455d3
Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
if uid and uid > 0:
try:
os.setresuid(uid, uid, uid)
- # Set environment
- os.environ['HOME'] = pwd.getpwuid(uid).pw_dir
except OSError as err:
ret_data_q.put(GbpServiceError("Setting UID (%s) failed: %s" %
(uid, err)))
sys.exit(_RET_FORK_ERR)
+ try:
+ # Set environment
+ os.environ['HOME'] = pwd.getpwuid(uid).pw_dir
+ except KeyError:
+ pass
# Call the function
try:
# Func must be a callable without arguments