From 4bc2516856bce713a07d0f5f8eaae11033a383af Mon Sep 17 00:00:00 2001 From: Susant Sahani Date: Sun, 17 Jan 2021 10:02:17 +0100 Subject: [PATCH] journal-remote: use hashmap_ensure_put --- src/journal-remote/journal-remote-main.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/journal-remote/journal-remote-main.c b/src/journal-remote/journal-remote-main.c index af8cde7eef..b00151c32e 100644 --- a/src/journal-remote/journal-remote-main.c +++ b/src/journal-remote/journal-remote-main.c @@ -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;