tree-wide: always use TAKE_FD() when calling rearrange_stdio()
rearrange_stdio() invalidates specified fds even on failure, which means we should always invalidate the fds we pass in no matter what. Let's make this explicit by using TAKE_FD() for that everywhere. Note that in many places we such invalidation doesnt get us much behaviour-wise, since we don't use the variables anymore later. But TAKE_FD() in a way is also documentation, it encodes explicitly that the fds are invalidated here, so I think it's a good thing to always make this explicit here.
This commit is contained in:
committed by
Luca Boccassi
parent
829b86bc0f
commit
aedec452b9
@@ -442,7 +442,7 @@ static int verify_gpg(
|
||||
|
||||
gpg_pipe[1] = safe_close(gpg_pipe[1]);
|
||||
|
||||
r = rearrange_stdio(gpg_pipe[0], -1, STDERR_FILENO);
|
||||
r = rearrange_stdio(TAKE_FD(gpg_pipe[0]), -1, STDERR_FILENO);
|
||||
if (r < 0) {
|
||||
log_error_errno(r, "Failed to rearrange stdin/stdout: %m");
|
||||
_exit(EXIT_FAILURE);
|
||||
|
||||
Reference in New Issue
Block a user