diff options
author | Lennart Poettering <lennart@poettering.net> | 2015-10-24 23:57:23 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2015-10-24 23:57:23 +0200 |
commit | 0c0f1bc8f76dadb6ccaf89e8df778188503a56cf (patch) | |
tree | d25a69defaff87f2f8aff38e709a8faf0d86c23c /src/core/unit-printf.c | |
parent | 7f66eb931d20cfdb7e1123673f2d6d08c2589bdf (diff) | |
parent | 115cbf7e209a86cf5317fa12d44566247b4af332 (diff) |
Merge pull request #1665 from evverx/unit-printf-fixes
core: various small fixes to unit-printf
Diffstat (limited to 'src/core/unit-printf.c')
-rw-r--r-- | src/core/unit-printf.c | 9 |
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) { |