1
0
mirror of https://github.com/systemd/systemd.git synced 2024-12-23 21:35:11 +03:00

execute: don't create /tmp and /var/tmp if both are inaccessible

If both /tmp and either /var/tmp or whole /var are inaccessible, there's no
need to create the temporary directories.
This commit is contained in:
Topi Miettinen 2020-03-10 15:36:51 +02:00
parent de46b2be07
commit efa2f3a18b
No known key found for this signature in database
GPG Key ID: 87E1A51C590B0577

View File

@ -5371,7 +5371,10 @@ static int exec_runtime_make(Manager *m, const ExecContext *c, const char *id, E
if (!c->private_network && !c->private_tmp && !c->network_namespace_path)
return 0;
if (c->private_tmp) {
if (c->private_tmp &&
!(prefixed_path_strv_contains(c->inaccessible_paths, "/tmp") &&
(prefixed_path_strv_contains(c->inaccessible_paths, "/var/tmp") ||
prefixed_path_strv_contains(c->inaccessible_paths, "/var")))) {
r = setup_tmp_dirs(id, &tmp_dir, &var_tmp_dir);
if (r < 0)
return r;