diff --git a/common/exechelp-w32.c b/common/exechelp-w32.c index 11bcea78a..a77e27c53 100644 --- a/common/exechelp-w32.c +++ b/common/exechelp-w32.c @@ -713,9 +713,10 @@ gnupg_wait_process (const char *pgmname, pid_t pid, int hang, int *r_exitcode) } else if (exc) { - log_error (_("error running '%s': exit status %d\n"), - pgmname, (int)exc ); - if (r_exitcode) + if (!r_exitcode) + log_error (_("error running '%s': exit status %d\n"), + pgmname, (int)exc); + else *r_exitcode = (int)exc; ec = GPG_ERR_GENERAL; }