summaryrefslogtreecommitdiff
path: root/src/core/unit.c
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2016-04-30 18:00:46 -0400
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2016-04-30 18:00:46 -0400
commitbc1d8669b8339e8c9420f42b0662bfffa98f320e (patch)
tree2c42ab297e6f4c9b98f65ba5bcc50b3d2df36364 /src/core/unit.c
parentb79660e6acb964f94ddba0ea4e1182215934dfc3 (diff)
parentf4bf8d2f45b02c26234219d07bfd3a41290cc84e (diff)
Merge pull request #3152 from poettering/aliasfix
Refuse aliases to non-aliasable units in more places Fixes #2730.
Diffstat (limited to 'src/core/unit.c')
-rw-r--r--src/core/unit.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/core/unit.c b/src/core/unit.c
index 81cd7ee2b8..64466e4fb4 100644
--- a/src/core/unit.c
+++ b/src/core/unit.c
@@ -720,6 +720,9 @@ int unit_merge(Unit *u, Unit *other) {
if (!u->instance != !other->instance)
return -EINVAL;
+ if (UNIT_VTABLE(u)->no_alias) /* Merging only applies to unit names that support aliases */
+ return -EEXIST;
+
if (other->load_state != UNIT_STUB &&
other->load_state != UNIT_NOT_FOUND)
return -EEXIST;
@@ -776,9 +779,9 @@ int unit_merge(Unit *u, Unit *other) {
}
int unit_merge_by_name(Unit *u, const char *name) {
+ _cleanup_free_ char *s = NULL;
Unit *other;
int r;
- _cleanup_free_ char *s = NULL;
assert(u);
assert(name);