summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2020-05-27 16:36:38 +0200
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2020-06-10 09:45:58 +0200
commite2ea0056818bc46d355d751321731a0d8d6d3a88 (patch)
treeaddde2fb181fb816aab7f986f31b2a3e3578e41b /src
parent934ef6a5220a0486ef4c212c01a91064024cb998 (diff)
downloadsystemd-e2ea0056818bc46d355d751321731a0d8d6d3a88.tar.gz
core: do not touch instance from unit_choose_id()
unit_choose_id() is about marking one of the aliases of the unit as the main name. With the preparatory work in previous patches, all aliases of the unit must have the same instance, so the operation to update the instance is a noop.
Diffstat (limited to 'src')
-rw-r--r--src/core/unit.c11
1 files changed, 1 insertions, 10 deletions
diff --git a/src/core/unit.c b/src/core/unit.c
index 091372b9e7..fdeed7e7c5 100644
--- a/src/core/unit.c
+++ b/src/core/unit.c
@@ -317,7 +317,7 @@ int unit_add_name(Unit *u, const char *text) {
}
int unit_choose_id(Unit *u, const char *name) {
- _cleanup_free_ char *t = NULL, *i = NULL;
+ _cleanup_free_ char *t = NULL;
char *s;
int r;
@@ -343,11 +343,6 @@ int unit_choose_id(Unit *u, const char *name) {
if (!s)
return -ENOENT;
- /* Determine the new instance from the new id */
- r = unit_name_to_instance(name, &i);
- if (r < 0)
- return r;
-
if (u->id) {
r = set_remove_and_put(u->aliases, name, u->id);
if (r < 0)
@@ -356,10 +351,6 @@ int unit_choose_id(Unit *u, const char *name) {
assert_se(set_remove(u->aliases, name)); /* see set_get() above… */
u->id = s; /* Old u->id is now stored in the set, and s is not stored anywhere */
-
- free(u->instance);
- u->instance = i;
-
unit_add_to_dbus_queue(u);
return 0;