chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
systemctl: fix 'systemctl enable getty@.service'
[elogind.git]
/
src
/
unit-name.c
diff --git
a/src/unit-name.c
b/src/unit-name.c
index 0e86b554c2eee4382c742fdd2f107b2e8ce01aed..cd6e3cea5c5398fd9572c9301130e0ea00504bd3 100644
(file)
--- a/
src/unit-name.c
+++ b/
src/unit-name.c
@@
-32,7
+32,7
@@
"ABCDEFGHIJKLMNOPQRSTUVWXYZ" \
":-_.\\"
"ABCDEFGHIJKLMNOPQRSTUVWXYZ" \
":-_.\\"
-bool unit_name_is_valid_no_type(const char *n) {
+bool unit_name_is_valid_no_type(const char *n
, bool template_ok
) {
const char *e, *i, *at;
/* Valid formats:
const char *e, *i, *at;
/* Valid formats:
@@
-63,7
+63,7
@@
bool unit_name_is_valid_no_type(const char *n) {
if (at == n)
return false;
if (at == n)
return false;
- if (
at[1] == '.'
)
+ if (
!template_ok && at+1 == e
)
return false;
}
return false;
}
@@
-150,7
+150,7
@@
char *unit_name_change_suffix(const char *n, const char *suffix) {
size_t a, b;
assert(n);
size_t a, b;
assert(n);
- assert(unit_name_is_valid_no_type(n));
+ assert(unit_name_is_valid_no_type(n
, true
));
assert(suffix);
assert_se(e = strrchr(n, '.'));
assert(suffix);
assert_se(e = strrchr(n, '.'));