execute: use empty_to_root() a bit more

This commit is contained in:
Lennart Poettering 2020-10-01 10:53:56 +02:00
parent 74e1252072
commit 14eb3285ab
2 changed files with 9 additions and 6 deletions

View File

@ -9,3 +9,8 @@ expression s;
@@
- (empty_or_root(s) ? "/" : s)
+ empty_to_root(s)
@@
expression s;
@@
- (s ? s : "/")
+ empty_to_root(s)

View File

@ -3245,10 +3245,8 @@ static int apply_working_directory(
wd = home;
} else if (context->working_directory)
wd = context->working_directory;
else
wd = "/";
} else
wd = empty_to_root(context->working_directory);
if (params->flags & EXEC_APPLY_CHROOT)
d = wd;
@ -5171,8 +5169,8 @@ void exec_context_dump(const ExecContext *c, FILE* f, const char *prefix) {
"%sProtectProc: %s\n"
"%sProcSubset: %s\n",
prefix, c->umask,
prefix, c->working_directory ? c->working_directory : "/",
prefix, c->root_directory ? c->root_directory : "/",
prefix, empty_to_root(c->working_directory),
prefix, empty_to_root(c->root_directory),
prefix, yes_no(c->non_blocking),
prefix, yes_no(c->private_tmp),
prefix, yes_no(c->private_devices),