1
0
mirror of git://git.gnupg.org/gnupg.git synced 2024-12-22 10:19:57 +01:00

common: New envvar GNUPG_EXEC_DEBUG_FLAGS.

* common/exechelp-w32.c (gnupg_spawn_process_detached): Silence
breakaway messages and turn them again into debug messages.
This commit is contained in:
Werner Koch 2021-09-13 17:07:18 +02:00
parent 265d993c76
commit f2b01025c3
No known key found for this signature in database
GPG Key ID: E3FDFF218E45B72B

View File

@ -903,10 +903,14 @@ gnupg_spawn_process_detached (const char *pgmname, const char *argv[],
BOOL in_job = FALSE;
gpg_err_code_t ec;
int rc;
int jobdebug;
/* We don't use ENVP. */
(void)envp;
cmdline = getenv ("GNUPG_EXEC_DEBUG_FLAGS");
jobdebug = (cmdline && (atoi (cmdline) & 1));
if ((ec = gnupg_access (pgmname, X_OK)))
return gpg_err_make (default_errsource, ec);
@ -955,24 +959,32 @@ gnupg_spawn_process_detached (const char *pgmname, const char *argv[],
else if ((info.BasicLimitInformation.LimitFlags &
JOB_OBJECT_LIMIT_BREAKAWAY_OK))
{
log_info ("Using CREATE_BREAKAWAY_FROM_JOB flag\n");
if (jobdebug)
log_debug ("Using CREATE_BREAKAWAY_FROM_JOB flag\n");
cr_flags |= CREATE_BREAKAWAY_FROM_JOB;
}
else if ((info.BasicLimitInformation.LimitFlags &
JOB_OBJECT_LIMIT_SILENT_BREAKAWAY_OK))
{
/* The child process should automatically detach from the job. */
log_info ("Not using CREATE_BREAKAWAY_FROM_JOB flag; "
"JOB_OBJECT_LIMIT_SILENT_BREAKAWAY_OK is set\n");
if (jobdebug)
log_debug ("Not using CREATE_BREAKAWAY_FROM_JOB flag; "
"JOB_OBJECT_LIMIT_SILENT_BREAKAWAY_OK is set\n");
}
else
{
/* It seems that the child process must remain in the job.
* This is not necessarily an error, although it can cause premature
* termination of the child process when the job is closed. */
log_info ("Not using CREATE_BREAKAWAY_FROM_JOB flag\n");
if (jobdebug)
log_debug ("Not using CREATE_BREAKAWAY_FROM_JOB flag\n");
}
}
else
{
if (jobdebug)
log_debug ("Process is not in a Job\n");
}
/* log_debug ("CreateProcess(detached), path='%s' cmdline='%s'\n", */
/* pgmname, cmdline); */