1
0
mirror of git://git.gnupg.org/gnupg.git synced 2024-11-12 21:58:50 +01:00

Replace gnupg_spawn_process_detached for POSIX.

Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
This commit is contained in:
NIIBE Yutaka 2022-11-28 13:55:50 +09:00
parent be35640db3
commit 588f353db1
No known key found for this signature in database
GPG Key ID: 640114AF89DE6054
2 changed files with 20 additions and 6 deletions

View File

@ -81,7 +81,11 @@ run_umount_helper (const char *mountpoint)
args[1] = mountpoint;
args[2] = NULL;
err = gnupg_spawn_process_detached (pgmname, args, NULL);
err = gnupg_process_spawn (pgmname, args,
(GNUPG_PROCESS_DETACHED | GNUPG_PROCESS_STDIN_NULL
| GNUPG_PROCESS_STDOUT_NULL
| GNUPG_PROCESS_STDERR_NULL),
NULL, NULL, NULL);
if (err)
log_error ("failed to run '%s': %s\n",
pgmname, gpg_strerror (err));

View File

@ -2315,6 +2315,14 @@ app_check_pin (card_t card, ctrl_t ctrl, const char *keyidstr,
}
static void
setup_env (struct spawn_cb_arg *sca)
{
char *v = sca->arg;
putenv (v);
}
static void
report_change (int slot, int old_status, int cur_status)
{
@ -2342,12 +2350,9 @@ report_change (int slot, int old_status, int cur_status)
else
{
gpg_error_t err;
const char *args[9], *envs[2];
const char *args[9];
char numbuf1[30], numbuf2[30], numbuf3[30];
envs[0] = envstr;
envs[1] = NULL;
sprintf (numbuf1, "%d", slot);
sprintf (numbuf2, "0x%04X", old_status);
sprintf (numbuf3, "0x%04X", cur_status);
@ -2364,7 +2369,12 @@ report_change (int slot, int old_status, int cur_status)
args[8] = NULL;
fname = make_filename (gnupg_homedir (), "scd-event", NULL);
err = gnupg_spawn_process_detached (fname, args, envs);
err = gnupg_process_spawn (fname, args,
(GNUPG_PROCESS_DETACHED
| GNUPG_PROCESS_STDIN_NULL
| GNUPG_PROCESS_STDOUT_NULL
| GNUPG_PROCESS_STDERR_NULL),
setup_env, envstr, NULL);
if (err && gpg_err_code (err) != GPG_ERR_ENOENT)
log_error ("failed to run event handler '%s': %s\n",
fname, gpg_strerror (err));