summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2023-02-18 18:09:22 +0100
committerYu Watanabe <watanabe.yu+github@gmail.com>2023-02-19 04:17:52 +0100
commitced30d69fa878b7132d818fa7cd6da163108c254 (patch)
tree652f1950a4b91ec1774c4b26b9276fa9c035b939
parentexec-util: propagate error in wait_for_terminate_and_check() (diff)
downloadsystemd-ced30d69fa878b7132d818fa7cd6da163108c254.tar.xz
systemd-ced30d69fa878b7132d818fa7cd6da163108c254.zip
exec-util: use TAKE_FD()
-rw-r--r--src/shared/exec-util.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/shared/exec-util.c b/src/shared/exec-util.c
index 51234fd025..2e8f5b8562 100644
--- a/src/shared/exec-util.c
+++ b/src/shared/exec-util.c
@@ -160,8 +160,7 @@ static int do_execute(
if (lseek(fd, 0, SEEK_SET) < 0)
return log_error_errno(errno, "Failed to seek on serialization fd: %m");
- r = callbacks[STDOUT_GENERATE](fd, callback_args[STDOUT_GENERATE]);
- fd = -EBADF;
+ r = callbacks[STDOUT_GENERATE](TAKE_FD(fd), callback_args[STDOUT_GENERATE]);
if (r < 0)
return log_error_errno(r, "Failed to process output from %s: %m", *path);
}
@@ -250,8 +249,7 @@ int execute_directories(
if (lseek(fd, 0, SEEK_SET) < 0)
return log_error_errno(errno, "Failed to rewind serialization fd: %m");
- r = callbacks[STDOUT_CONSUME](fd, callback_args[STDOUT_CONSUME]);
- fd = -EBADF;
+ r = callbacks[STDOUT_CONSUME](TAKE_FD(fd), callback_args[STDOUT_CONSUME]);
if (r < 0)
return log_error_errno(r, "Failed to parse returned data: %m");
return 0;