diff options
author | Susant Sahani <ssahani@vmware.com> | 2021-01-20 12:29:08 +0100 |
---|---|---|
committer | Susant Sahani <ssahani@vmware.com> | 2021-01-20 15:08:30 +0100 |
commit | faa7e5a43b857bc278d1a3038f5b1954e537cbb0 (patch) | |
tree | 4f4c5a660b3c8e970e8b628bbe480db1bfaac3d9 | |
parent | 23afa884d4f3bcd97160a893816f9ba170f62ad4 (diff) | |
download | systemd-faa7e5a43b857bc278d1a3038f5b1954e537cbb0.tar.gz |
Journal: Use hashmap_ensure_put
-rw-r--r-- | src/libsystemd/sd-journal/sd-journal.c | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/src/libsystemd/sd-journal/sd-journal.c b/src/libsystemd/sd-journal/sd-journal.c index 27251a2597..46b1cba145 100644 --- a/src/libsystemd/sd-journal/sd-journal.c +++ b/src/libsystemd/sd-journal/sd-journal.c @@ -80,10 +80,6 @@ static int journal_put_error(sd_journal *j, int r, const char *path) { if (r >= 0) return r; - k = hashmap_ensure_allocated(&j->errors, NULL); - if (k < 0) - return k; - if (path) { copy = strdup(path); if (!copy) @@ -91,7 +87,7 @@ static int journal_put_error(sd_journal *j, int r, const char *path) { } else copy = NULL; - k = hashmap_put(j->errors, INT_TO_PTR(r), copy); + k = hashmap_ensure_put(&j->errors, NULL, INT_TO_PTR(r), copy); if (k < 0) { free(copy); |