From 5e03c6e3b517286bbd65b48d88f60e5b83721894 Mon Sep 17 00:00:00 2001 From: Zbigniew Jędrzejewski-Szmek Date: Fri, 28 Nov 2014 11:28:10 -0500 Subject: systemctl: append default suffix only if none present Simplify unit_name_mangle() and unit_name_mangle_with_suffix() to always behave the same, and only append a suffix if there is no type suffix. If a user says 'isolate blah.device' it is better to return an error that the type cannot be isolated, than to try to isolate blah.device.target. --- src/shared/unit-name.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/shared/unit-name.h') diff --git a/src/shared/unit-name.h b/src/shared/unit-name.h index daeb56a860..6f139cc4c4 100644 --- a/src/shared/unit-name.h +++ b/src/shared/unit-name.h @@ -156,8 +156,10 @@ enum unit_name_mangle { MANGLE_GLOB, }; -char *unit_name_mangle(const char *name, enum unit_name_mangle allow_globs); char *unit_name_mangle_with_suffix(const char *name, enum unit_name_mangle allow_globs, const char *suffix); +static inline char *unit_name_mangle(const char *name, enum unit_name_mangle allow_globs) { + return unit_name_mangle_with_suffix(name, allow_globs, ".service"); +} int build_subslice(const char *slice, const char*name, char **subslice); -- cgit v1.2.3-54-g00ecf