]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
journal: context - use hashmap_ensure_put
authorSusant Sahani <ssahani@vmware.com>
Mon, 18 Jan 2021 11:16:34 +0000 (12:16 +0100)
committerSusant Sahani <ssahani@vmware.com>
Mon, 18 Jan 2021 11:16:34 +0000 (12:16 +0100)
src/journal/journald-context.c

index 577d5254c5c88d724bcf5d939b5db4387db67380..f67013e80ce494f990127de90ca631406f43c1b0 100644 (file)
@@ -109,10 +109,6 @@ static int client_context_new(Server *s, pid_t pid, ClientContext **ret) {
         assert(pid_is_valid(pid));
         assert(ret);
 
-        r = hashmap_ensure_allocated(&s->client_contexts, NULL);
-        if (r < 0)
-                return r;
-
         r = prioq_ensure_allocated(&s->client_contexts_lru, client_context_compare);
         if (r < 0)
                 return r;
@@ -136,7 +132,7 @@ static int client_context_new(Server *s, pid_t pid, ClientContext **ret) {
                 .log_ratelimit_burst = s->ratelimit_burst,
         };
 
-        r = hashmap_put(s->client_contexts, PID_TO_PTR(pid), c);
+        r = hashmap_ensure_put(&s->client_contexts, NULL, PID_TO_PTR(pid), c);
         if (r < 0)
                 return r;