tree-wide: use FORK_REARRANGE_STDIO and FORK_CLOSE_ALL_FDS
This commit is contained in:
@@ -414,7 +414,11 @@ static int verify_gpg(
|
||||
|
||||
gpg_home_created = true;
|
||||
|
||||
r = safe_fork("(gpg)", FORK_RESET_SIGNALS|FORK_DEATHSIG|FORK_LOG|FORK_RLIMIT_NOFILE_SAFE, &pid);
|
||||
r = safe_fork_full("(gpg)",
|
||||
(int[]) { gpg_pipe[0], -EBADF, STDERR_FILENO },
|
||||
NULL, 0,
|
||||
FORK_RESET_SIGNALS|FORK_CLOSE_ALL_FDS|FORK_DEATHSIG|FORK_REARRANGE_STDIO|FORK_LOG|FORK_RLIMIT_NOFILE_SAFE,
|
||||
&pid);
|
||||
if (r < 0)
|
||||
return r;
|
||||
if (r == 0) {
|
||||
@@ -437,14 +441,6 @@ static int verify_gpg(
|
||||
|
||||
/* Child */
|
||||
|
||||
gpg_pipe[1] = safe_close(gpg_pipe[1]);
|
||||
|
||||
r = rearrange_stdio(TAKE_FD(gpg_pipe[0]), -EBADF, STDERR_FILENO);
|
||||
if (r < 0) {
|
||||
log_error_errno(r, "Failed to rearrange stdin/stdout: %m");
|
||||
_exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
cmd[k++] = strjoina("--homedir=", gpg_home);
|
||||
|
||||
/* We add the user keyring only to the command line arguments, if it's around since gpg fails
|
||||
|
||||
Reference in New Issue
Block a user