chiark / gitweb /
hostname: read hostname for Gentoo
[elogind.git] / unit.c
diff --git a/unit.c b/unit.c
index 5c19b3b2da32626b5da0ce15a7850db35e723420..dea6b8bf7641dc6747ff42efd00bf45e34edf52a 100644 (file)
--- 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);