chiark / gitweb /
systemctl: fix 'systemctl enable getty@.service'
[elogind.git] / src / unit.c
index 2f8b92d3b5c08f3eba35efd63b769b3fb2d21b79..d45fe91560513b1ea8988404cc29ca65554f2f5a 100644 (file)
@@ -103,7 +103,7 @@ int unit_add_name(Unit *u, const char *text) {
         if (!s)
                 return -ENOMEM;
 
-        if (!unit_name_is_valid(s)) {
+        if (!unit_name_is_valid(s, false)) {
                 r = -EINVAL;
                 goto fail;
         }
@@ -2222,21 +2222,22 @@ UnitType unit_name_to_type(const char *n) {
         return _UNIT_TYPE_INVALID;
 }
 
-bool unit_name_is_valid(const char *n) {
+bool unit_name_is_valid(const char *n, bool template_ok) {
         UnitType t;
 
         t = unit_name_to_type(n);
         if (t < 0 || t >= _UNIT_TYPE_MAX)
                 return false;
 
-        return unit_name_is_valid_no_type(n);
+        return unit_name_is_valid_no_type(n, template_ok);
 }
 
 static const char* const unit_load_state_table[_UNIT_LOAD_STATE_MAX] = {
         [UNIT_STUB] = "stub",
         [UNIT_LOADED] = "loaded",
         [UNIT_ERROR] = "error",
-        [UNIT_MERGED] = "merged"
+        [UNIT_MERGED] = "merged",
+        [UNIT_BANNED] = "banned"
 };
 
 DEFINE_STRING_TABLE_LOOKUP(unit_load_state, UnitLoadState);