]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
share: bus-unit-procs - use hashmap_ensure_put
authorSusant Sahani <ssahani@vmware.com>
Mon, 18 Jan 2021 17:24:56 +0000 (18:24 +0100)
committerSusant Sahani <ssahani@vmware.com>
Mon, 18 Jan 2021 20:53:16 +0000 (21:53 +0100)
src/shared/bus-unit-procs.c

index 3e97be9671566012f5a1df84cdba7cc67137fbc1..b76125e551f91225119973f10aa06eaa3c56cb9a 100644 (file)
@@ -104,11 +104,7 @@ static int add_process(
         if (r < 0)
                 return r;
 
-        r = hashmap_ensure_allocated(&cg->pids, &trivial_hash_ops);
-        if (r < 0)
-                return r;
-
-        return hashmap_put(cg->pids, PID_TO_PTR(pid), (void*) name);
+        return hashmap_ensure_put(&cg->pids, &trivial_hash_ops, PID_TO_PTR(pid), (void*) name);
 }
 
 static void remove_cgroup(Hashmap *cgroups, struct CGroupInfo *cg) {