From 237aca5fbeebde64bf28725b6ccaf31bf2518a2b Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Mon, 6 Jan 2025 23:29:32 +0100 Subject: [PATCH] machine: switch to using cleanup handling for child process cleanup --- src/machine/machine.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/machine/machine.c b/src/machine/machine.c index 7abf5437c4..752ba66790 100644 --- a/src/machine/machine.c +++ b/src/machine/machine.c @@ -991,8 +991,8 @@ int machine_copy_from_to( _cleanup_close_ int host_fd = -EBADF, target_mntns_fd = -EBADF, source_mntns_fd = -EBADF; _cleanup_close_pair_ int errno_pipe_fd[2] = EBADF_PAIR; _cleanup_free_ char *host_basename = NULL, *container_basename = NULL; + _cleanup_(sigkill_waitp) pid_t child = 0; uid_t uid_shift; - pid_t child; int r; assert(manager); @@ -1094,12 +1094,12 @@ int machine_copy_from_to( Operation *operation; r = operation_new(manager, machine, child, errno_pipe_fd[0], &operation); - if (r < 0) { - sigkill_wait(child); + if (r < 0) return r; - } TAKE_FD(errno_pipe_fd[0]); + TAKE_PID(child); + *ret = operation; return 0; }