mirror of
https://github.com/systemd/systemd-stable.git
synced 2024-12-23 17:34:00 +03:00
remount-fs: Use hashmap_ensure_put
This commit is contained in:
parent
acf56b72f2
commit
b5bcd73895
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user