summaryrefslogtreecommitdiff
path: root/src/remount-fs
diff options
context:
space:
mode:
authorSusant Sahani <ssahani@vmware.com>2021-01-18 21:38:46 +0100
committerSusant Sahani <ssahani@vmware.com>2021-01-18 21:53:11 +0100
commitb5bcd738959790259fa349d1d835638cd7bd72e0 (patch)
tree3b8bd49876234914fcc664debd89bc6fe20fc1f8 /src/remount-fs
parentacf56b72f26609ee5431e23d4e5bbaf7f730d236 (diff)
downloadsystemd-b5bcd738959790259fa349d1d835638cd7bd72e0.tar.gz
remount-fs: Use hashmap_ensure_put
Diffstat (limited to 'src/remount-fs')
-rw-r--r--src/remount-fs/remount-fs.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/remount-fs/remount-fs.c b/src/remount-fs/remount-fs.c
index 19f5bd0d11..9668a49dc4 100644
--- a/src/remount-fs/remount-fs.c
+++ b/src/remount-fs/remount-fs.c
@@ -31,17 +31,15 @@ static int track_pid(Hashmap **h, const char *path, pid_t pid) {
assert(path);
assert(pid_is_valid(pid));
- r = hashmap_ensure_allocated(h, NULL);
- if (r < 0)
- return log_oom();
-
c = strdup(path);
if (!c)
return log_oom();
- r = hashmap_put(*h, PID_TO_PTR(pid), c);
- if (r < 0)
+ r = hashmap_ensure_put(h, NULL, PID_TO_PTR(pid), c);
+ if (r == -ENOMEM)
return log_oom();
+ if (r < 0)
+ return log_error_errno(r, "Failed to store pid " PID_FMT, pid);
TAKE_PTR(c);
return 0;