mirror of
git://git.gnupg.org/gnupg.git
synced 2024-12-22 10:19:57 +01:00
Support gnupg_process_spawn with R_PROC=NULL.
-- The use case of system(3) call. Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
This commit is contained in:
parent
af4a6fff0d
commit
62496e9f30
@ -1118,7 +1118,8 @@ gnupg_process_spawn (const char *pgmname, const char *argv1[],
|
||||
|
||||
check_syscall_func ();
|
||||
|
||||
*r_process = NULL;
|
||||
if (r_process)
|
||||
*r_process = NULL;
|
||||
|
||||
/* Create the command line argument array. */
|
||||
i = 0;
|
||||
@ -1305,6 +1306,13 @@ gnupg_process_spawn (const char *pgmname, const char *argv1[],
|
||||
process->wstatus = -1;
|
||||
process->terminated = 0;
|
||||
|
||||
if (r_process == NULL)
|
||||
{
|
||||
ec = gnupg_process_wait (process, 1);
|
||||
gnupg_process_release (process);
|
||||
return ec;
|
||||
}
|
||||
|
||||
*r_process = process;
|
||||
return 0;
|
||||
}
|
||||
@ -1496,7 +1504,6 @@ gnupg_process_wait (gnupg_process_t process, int hang)
|
||||
int status;
|
||||
pid_t pid;
|
||||
|
||||
|
||||
if (process->terminated)
|
||||
/* Already terminated. */
|
||||
return 0;
|
||||
|
@ -1224,7 +1224,8 @@ gnupg_process_spawn (const char *pgmname, const char *argv[],
|
||||
|
||||
check_syscall_func ();
|
||||
|
||||
*r_process = NULL;
|
||||
if (r_process)
|
||||
*r_process = NULL;
|
||||
|
||||
/* Build the command line. */
|
||||
ec = build_w32_commandline (pgmname, argv, &cmdline);
|
||||
@ -1486,6 +1487,13 @@ gnupg_process_spawn (const char *pgmname, const char *argv[],
|
||||
process->exitcode = -1;
|
||||
process->terminated = 0;
|
||||
|
||||
if (r_process == NULL)
|
||||
{
|
||||
ec = gnupg_process_wait (process, 1);
|
||||
gnupg_process_release (process);
|
||||
return ec;
|
||||
}
|
||||
|
||||
*r_process = process;
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user