X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=unit.c;h=dea6b8bf7641dc6747ff42efd00bf45e34edf52a;hb=3177a7fa12247d30b854fcb7697cd578b9086bf5;hp=5c19b3b2da32626b5da0ce15a7850db35e723420;hpb=701cc384c283206a29b21e4e7302e5cf5f2d9433;p=elogind.git diff --git a/unit.c b/unit.c index 5c19b3b2d..dea6b8bf7 100644 --- a/unit.c +++ b/unit.c @@ -47,7 +47,8 @@ const UnitVTable * const unit_vtable[_UNIT_TYPE_MAX] = { [UNIT_DEVICE] = &device_vtable, [UNIT_MOUNT] = &mount_vtable, [UNIT_AUTOMOUNT] = &automount_vtable, - [UNIT_SNAPSHOT] = &snapshot_vtable + [UNIT_SNAPSHOT] = &snapshot_vtable, + [UNIT_SWAP] = &swap_vtable }; Unit *unit_new(Manager *m) { @@ -125,6 +126,11 @@ int unit_add_name(Unit *u, const char *text) { goto fail; } + if (hashmap_size(u->meta.manager->units) >= MANAGER_MAX_NAMES) { + r = -E2BIG; + goto fail; + } + if ((r = set_put(u->meta.names, s)) < 0) { if (r == -EEXIST) r = 0; @@ -563,7 +569,7 @@ void unit_dump(Unit *u, FILE *f, const char *prefix) { prefix2 = p2 ? p2 : prefix; fprintf(f, - "%s→ Unit %s:\n" + "%s-> Unit %s:\n" "%s\tDescription: %s\n" "%s\tInstance: %s\n" "%s\tUnit Load State: %s\n" @@ -1834,7 +1840,8 @@ static const char* const unit_type_table[_UNIT_TYPE_MAX] = { [UNIT_DEVICE] = "device", [UNIT_MOUNT] = "mount", [UNIT_AUTOMOUNT] = "automount", - [UNIT_SNAPSHOT] = "snapshot" + [UNIT_SNAPSHOT] = "snapshot", + [UNIT_SWAP] = "swap" }; DEFINE_STRING_TABLE_LOOKUP(unit_type, UnitType);