Make use of internal iospawn flags more flexible.
* src/priv-io.h (IOSPAWN_FLAG_DETACHED): New. Renumber the others. * src/w32-io.c (_gpgme_io_spawn): Use DETACHED_PROCESS process only if IOSPAWN_FLAG_DETACHED is given. * src/w32-qt-io.cpp (_gpgme_io_spawn): Ditto. * src/w32-glib-io.c (_gpgme_io_spawn): Ditto. * src/assuan-support.c (my_spawn): Pass IOSPAWN_FLAG_DETACHED flags. * src/dirinfo.c (read_gpgconf_dirs): Ditto. * src/engine-gpg.c (start): Ditto. * src/engine-gpgconf.c (gpgconf_read, gpgconf_write): Ditto. * src/version.c (_gpgme_get_program_version): Ditto.
This commit is contained in:
parent
617d3be629
commit
443f6b76a9
@ -168,7 +168,8 @@ my_spawn (assuan_context_t ctx, pid_t *r_pid, const char *name,
|
||||
fd_items[i].fd = -1;
|
||||
fd_items[i].dup_to = -1;
|
||||
|
||||
err = _gpgme_io_spawn (name, (char*const*)argv, IOSPAWN_FLAG_NOCLOSE,
|
||||
err = _gpgme_io_spawn (name, (char*const*)argv,
|
||||
(IOSPAWN_FLAG_NOCLOSE | IOSPAWN_FLAG_DETACHED),
|
||||
fd_items, atfork, atforkvalue, r_pid);
|
||||
if (! err)
|
||||
{
|
||||
|
@ -156,7 +156,8 @@ read_gpgconf_dirs (const char *pgmname, int components)
|
||||
|
||||
cfd[0].fd = rp[1];
|
||||
|
||||
status = _gpgme_io_spawn (pgmname, argv, 0, cfd, NULL, NULL, NULL);
|
||||
status = _gpgme_io_spawn (pgmname, argv, IOSPAWN_FLAG_DETACHED,
|
||||
cfd, NULL, NULL, NULL);
|
||||
if (status < 0)
|
||||
{
|
||||
_gpgme_io_close (rp[0]);
|
||||
|
@ -1359,7 +1359,7 @@ start (engine_gpg_t gpg)
|
||||
fd_list[n].dup_to = -1;
|
||||
|
||||
status = _gpgme_io_spawn (pgmname, gpg->argv,
|
||||
IOSPAWN_FLAG_ALLOW_SET_FG,
|
||||
(IOSPAWN_FLAG_DETACHED |IOSPAWN_FLAG_ALLOW_SET_FG),
|
||||
fd_list, NULL, NULL, &pid);
|
||||
{
|
||||
int saved_err = gpg_error_from_syserror ();
|
||||
|
@ -228,7 +228,8 @@ gpgconf_read (void *engine, char *arg1, char *arg2,
|
||||
|
||||
cfd[0].fd = rp[1];
|
||||
|
||||
status = _gpgme_io_spawn (gpgconf->file_name, argv, 0, cfd, NULL, NULL, NULL);
|
||||
status = _gpgme_io_spawn (gpgconf->file_name, argv,
|
||||
IOSPAWN_FLAG_DETACHED, cfd, NULL, NULL, NULL);
|
||||
if (status < 0)
|
||||
{
|
||||
_gpgme_io_close (rp[0]);
|
||||
@ -697,7 +698,8 @@ gpgconf_write (void *engine, char *arg1, char *arg2, gpgme_data_t conf)
|
||||
|
||||
cfd[0].fd = rp[0];
|
||||
|
||||
status = _gpgme_io_spawn (gpgconf->file_name, argv, 0, cfd, NULL, NULL, NULL);
|
||||
status = _gpgme_io_spawn (gpgconf->file_name, argv,
|
||||
IOSPAWN_FLAG_DETACHED, cfd, NULL, NULL, NULL);
|
||||
if (status < 0)
|
||||
{
|
||||
_gpgme_io_close (rp[0]);
|
||||
|
@ -372,8 +372,6 @@ _gpgme_io_spawn (const char *path, char *const argv[], unsigned int flags,
|
||||
int status;
|
||||
int signo;
|
||||
|
||||
(void)flags;
|
||||
|
||||
TRACE_BEG1 (DEBUG_SYSIO, "_gpgme_io_spawn", path,
|
||||
"path=%s", path);
|
||||
i = 0;
|
||||
|
@ -75,11 +75,13 @@ int _gpgme_io_set_close_notify (int fd, _gpgme_close_notify_handler_t handler,
|
||||
void *value);
|
||||
int _gpgme_io_set_nonblocking (int fd);
|
||||
|
||||
/* Under Windows do not allocate a console. */
|
||||
#define IOSPAWN_FLAG_DETACHED 1
|
||||
/* A flag to tell the spawn function to allow the child process to set
|
||||
the foreground window. */
|
||||
#define IOSPAWN_FLAG_ALLOW_SET_FG 1
|
||||
#define IOSPAWN_FLAG_ALLOW_SET_FG 2
|
||||
/* Don't close any child FDs. */
|
||||
#define IOSPAWN_FLAG_NOCLOSE 2
|
||||
#define IOSPAWN_FLAG_NOCLOSE 4
|
||||
|
||||
/* Spawn the executable PATH with ARGV as arguments. After forking
|
||||
close all fds except for those in FD_LIST in the child, then
|
||||
|
@ -321,7 +321,8 @@ _gpgme_get_program_version (const char *const file_name)
|
||||
|
||||
cfd[0].fd = rp[1];
|
||||
|
||||
status = _gpgme_io_spawn (file_name, argv, 0, cfd, NULL, NULL, NULL);
|
||||
status = _gpgme_io_spawn (file_name, argv,
|
||||
IOSPAWN_FLAG_DETACHED, cfd, NULL, NULL, NULL);
|
||||
if (status < 0)
|
||||
{
|
||||
_gpgme_io_close (rp[0]);
|
||||
|
@ -662,6 +662,7 @@ _gpgme_io_spawn (const char *path, char * const argv[], unsigned int flags,
|
||||
si.hStdError = INVALID_HANDLE_VALUE;
|
||||
|
||||
cr_flags |= CREATE_SUSPENDED;
|
||||
if ((flags & IOSPAWN_FLAG_DETACHED))
|
||||
cr_flags |= DETACHED_PROCESS;
|
||||
if (!CreateProcessA (_gpgme_get_w32spawn_path (),
|
||||
arg_string,
|
||||
|
@ -1598,6 +1598,7 @@ _gpgme_io_spawn (const char *path, char *const argv[], unsigned int flags,
|
||||
si.hStdError = INVALID_HANDLE_VALUE;
|
||||
|
||||
cr_flags |= CREATE_SUSPENDED;
|
||||
if ((flags & IOSPAWN_FLAG_DETACHED))
|
||||
cr_flags |= DETACHED_PROCESS;
|
||||
cr_flags |= GetPriorityClass (GetCurrentProcess ());
|
||||
if (!CreateProcessA (_gpgme_get_w32spawn_path (),
|
||||
|
@ -469,6 +469,7 @@ _gpgme_io_spawn (const char *path, char * const argv[], unsigned int flags,
|
||||
si.hStdError = INVALID_HANDLE_VALUE;
|
||||
|
||||
cr_flags |= CREATE_SUSPENDED;
|
||||
if ((flags & IOSPAWN_FLAG_DETACHED))
|
||||
cr_flags |= DETACHED_PROCESS;
|
||||
if (!CreateProcessA (_gpgme_get_w32spawn_path (),
|
||||
arg_string,
|
||||
|
Loading…
x
Reference in New Issue
Block a user