]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
journal-remote: use hashmap_ensure_put
authorSusant Sahani <ssahani@vmware.com>
Sun, 17 Jan 2021 09:02:17 +0000 (10:02 +0100)
committerSusant Sahani <ssahani@vmware.com>
Sun, 17 Jan 2021 13:24:44 +0000 (14:24 +0100)
src/journal-remote/journal-remote-main.c

index af8cde7eef4060354bc86eb32394e6f46c5f1200..b00151c32e8247250c140aa6f617bd33f75ac072 100644 (file)
@@ -483,13 +483,11 @@ static int setup_microhttpd_server(RemoteServer *s,
                 goto error;
         }
 
-        r = hashmap_ensure_allocated(&s->daemons, &uint64_hash_ops);
-        if (r < 0) {
+        r = hashmap_ensure_put(&s->daemons, &uint64_hash_ops, &d->fd, d);
+        if (r == -ENOMEM) {
                 log_oom();
                 goto error;
         }
-
-        r = hashmap_put(s->daemons, &d->fd, d);
         if (r < 0) {
                 log_error_errno(r, "Failed to add daemon to hashmap: %m");
                 goto error;