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,6 +1118,7 @@ gnupg_process_spawn (const char *pgmname, const char *argv1[],
|
||||
|
||||
check_syscall_func ();
|
||||
|
||||
if (r_process)
|
||||
*r_process = NULL;
|
||||
|
||||
/* Create the command line argument array. */
|
||||
@ -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,6 +1224,7 @@ gnupg_process_spawn (const char *pgmname, const char *argv[],
|
||||
|
||||
check_syscall_func ();
|
||||
|
||||
if (r_process)
|
||||
*r_process = NULL;
|
||||
|
||||
/* Build the command line. */
|
||||
@ -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