From: Susant Sahani Date: Sun, 17 Jan 2021 09:02:17 +0000 (+0100) Subject: journal-remote: use hashmap_ensure_put X-Git-Tag: v248-rc1~314^2~8 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4bc2516856bce713a07d0f5f8eaae11033a383af;p=thirdparty%2Fsystemd.git journal-remote: use hashmap_ensure_put --- diff --git a/src/journal-remote/journal-remote-main.c b/src/journal-remote/journal-remote-main.c index af8cde7eef4..b00151c32e8 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;