summaryrefslogtreecommitdiffstats
path: root/src/shared/exec-util.c
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2025-01-22 02:49:07 +0100
committerYu Watanabe <watanabe.yu+github@gmail.com>2025-01-23 10:22:52 +0100
commit60cc858e9d8238e8bb83a6c2dfcfbb4b94f4ad84 (patch)
tree1fb6d80ab12ccb26f71ae58fd8cb6db33baf3e1e /src/shared/exec-util.c
parentnetwork: use hash ops with destructor (diff)
downloadsystemd-60cc858e9d8238e8bb83a6c2dfcfbb4b94f4ad84.tar.xz
systemd-60cc858e9d8238e8bb83a6c2dfcfbb4b94f4ad84.zip
exec-util: use hash ops with destructor
Diffstat (limited to '')
-rw-r--r--src/shared/exec-util.c10
1 files changed, 2 insertions, 8 deletions
diff --git a/src/shared/exec-util.c b/src/shared/exec-util.c
index c673e344ee..bc997a9383 100644
--- a/src/shared/exec-util.c
+++ b/src/shared/exec-util.c
@@ -99,7 +99,7 @@ static int do_execute(
char *envp[],
ExecDirFlags flags) {
- _cleanup_hashmap_free_free_ Hashmap *pids = NULL;
+ _cleanup_hashmap_free_ Hashmap *pids = NULL;
bool parallel_execution;
int r;
@@ -114,12 +114,6 @@ static int do_execute(
parallel_execution = FLAGS_SET(flags, EXEC_DIR_PARALLEL) && !callbacks;
- if (parallel_execution) {
- pids = hashmap_new(NULL);
- if (!pids)
- return log_oom();
- }
-
/* Abort execution of this process after the timeout. We simply rely on SIGALRM as
* default action terminating the process, and turn on alarm(). */
@@ -176,7 +170,7 @@ static int do_execute(
continue;
if (parallel_execution) {
- r = hashmap_put(pids, PID_TO_PTR(pid), t);
+ r = hashmap_ensure_put(&pids, &trivial_hash_ops_value_free, PID_TO_PTR(pid), t);
if (r < 0)
return log_oom();
t = NULL;