summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndre Heinecke <aheinecke@gnupg.org>2019-04-09 13:25:08 +0200
committerAndre Heinecke <aheinecke@gnupg.org>2019-04-09 13:25:08 +0200
commit937adfdcbb22f715c5a331e5e2d4546ac15a1b7e (patch)
treeb43a8c48f96847ffdacbfc73e2f0b37f2c1d4e8b
parent4a4680f8901ecdcb7e8d5ed55f48226ccfccd7c8 (diff)
downloadgpgme-937adfdcbb22f715c5a331e5e2d4546ac15a1b7e.tar.gz
core,w32: Show w32-spawn warning only once
* src/w32-io.c (_gpgme_io_spawn): Show MessageBox only once. -- This prevents multiple message boxes from showing when the GPGME installation is unworkable. GnuPG-Bug-Id: T4453
-rw-r--r--src/w32-io.c33
1 files changed, 19 insertions, 14 deletions
diff --git a/src/w32-io.c b/src/w32-io.c
index 919ca6fd..67f93baa 100644
--- a/src/w32-io.c
+++ b/src/w32-io.c
@@ -1389,6 +1389,7 @@ _gpgme_io_spawn (const char *path, char *const argv[], unsigned int flags,
int tmp_fd;
char *tmp_name;
const char *spawnhelper;
+ static int spawn_warning_shown = 0;
TRACE_BEG (DEBUG_SYSIO, "_gpgme_io_spawn", path,
"path=%s", path);
@@ -1456,20 +1457,24 @@ _gpgme_io_spawn (const char *path, char *const argv[], unsigned int flags,
up their installation this should also be properly communicated
as otherwise calls to gnupg will result in unsupported protocol
errors that do not explain a lot. */
- char *msg;
- gpgrt_asprintf (&msg, "gpgme-w32spawn.exe was not found in the "
- "detected installation directory of GpgME"
- "\n\t\"%s\"\n\n"
- "Crypto operations will not work.\n\n"
- "If you see this it indicates a problem "
- "with your installation.\n"
- "Please report the problem to your "
- "distributor of GpgME.\n\n"
- "Developer's Note: The install dir can be "
- "manually set with: gpgme_set_global_flag",
- _gpgme_get_inst_dir ());
- MessageBoxA (NULL, msg, "GpgME not installed correctly", MB_OK);
- gpgrt_free (msg);
+ if (!spawn_warning_shown)
+ {
+ char *msg;
+ gpgrt_asprintf (&msg, "gpgme-w32spawn.exe was not found in the "
+ "detected installation directory of GpgME"
+ "\n\t\"%s\"\n\n"
+ "Crypto operations will not work.\n\n"
+ "If you see this it indicates a problem "
+ "with your installation.\n"
+ "Please report the problem to your "
+ "distributor of GpgME.\n\n"
+ "Developer's Note: The install dir can be "
+ "manually set with: gpgme_set_global_flag",
+ _gpgme_get_inst_dir ());
+ MessageBoxA (NULL, msg, "GpgME not installed correctly", MB_OK);
+ gpgrt_free (msg);
+ spawn_warning_shown = 1;
+ }
gpg_err_set_errno (EIO);
close (tmp_fd);
DeleteFileA (tmp_name);