]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
sd-event: Use hashmap_ensure_put
authorSusant Sahani <ssahani@vmware.com>
Wed, 20 Jan 2021 13:13:08 +0000 (14:13 +0100)
committerSusant Sahani <ssahani@vmware.com>
Wed, 20 Jan 2021 14:13:21 +0000 (15:13 +0100)
src/libsystemd/sd-event/sd-event.c

index f4ab2e4b788fe000b2b1173c64958fd2c8b4cae1..010e62824250dce178b7b10a7b989a77b561c783 100644 (file)
@@ -1723,10 +1723,6 @@ static int event_make_inotify_data(
 
         fd = fd_move_above_stdio(fd);
 
-        r = hashmap_ensure_allocated(&e->inotify_data, &uint64_hash_ops);
-        if (r < 0)
-                return r;
-
         d = new(struct inotify_data, 1);
         if (!d)
                 return -ENOMEM;
@@ -1737,7 +1733,7 @@ static int event_make_inotify_data(
                 .priority = priority,
         };
 
-        r = hashmap_put(e->inotify_data, &d->priority, d);
+        r = hashmap_ensure_put(&e->inotify_data, &uint64_hash_ops, &d->priority, d);
         if (r < 0) {
                 d->fd = safe_close(d->fd);
                 free(d);