summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2015-10-24 23:57:23 +0200
committerLennart Poettering <lennart@poettering.net>2015-10-24 23:57:23 +0200
commit0c0f1bc8f76dadb6ccaf89e8df778188503a56cf (patch)
treed25a69defaff87f2f8aff38e709a8faf0d86c23c
parent7f66eb931d20cfdb7e1123673f2d6d08c2589bdf (diff)
parent115cbf7e209a86cf5317fa12d44566247b4af332 (diff)
Merge pull request #1665 from evverx/unit-printf-fixes
core: various small fixes to unit-printf
-rw-r--r--src/core/unit-printf.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/core/unit-printf.c b/src/core/unit-printf.c
index 0889769d03..f327953266 100644
--- a/src/core/unit-printf.c
+++ b/src/core/unit-printf.c
@@ -63,10 +63,7 @@ static int specifier_instance_unescaped(char specifier, void *data, void *userda
assert(u);
- if (!u->instance)
- return -EINVAL;
-
- return unit_name_unescape(u->instance, ret);
+ return unit_name_unescape(strempty(u->instance), ret);
}
static int specifier_filename(char specifier, void *data, void *userdata, char **ret) {
@@ -128,6 +125,8 @@ static int specifier_cgroup_slice(char specifier, void *data, void *userdata, ch
n = unit_default_cgroup_path(slice);
} else
n = strdup(u->manager->cgroup_root);
+ if (!n)
+ return -ENOMEM;
*ret = n;
return 0;
@@ -166,7 +165,7 @@ static int specifier_user_name(char specifier, void *data, void *userdata, char
c = unit_get_exec_context(u);
if (!c)
- return -EINVAL;
+ return -EOPNOTSUPP;
if (u->manager->running_as == MANAGER_SYSTEM) {