summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/core/execute.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/core/execute.c b/src/core/execute.c
index f57eb26388..1e32697723 100644
--- a/src/core/execute.c
+++ b/src/core/execute.c
@@ -815,10 +815,13 @@ static int get_fixed_user(const ExecContext *c, const char **user,
assert(c);
+ if (!c->user)
+ return 0;
+
/* Note that we don't set $HOME or $SHELL if they are not particularly enlightening anyway
* (i.e. are "/" or "/bin/nologin"). */
- name = c->user ?: "root";
+ name = c->user;
r = get_user_creds_clean(&name, uid, gid, home, shell);
if (r < 0)
return r;