aboutsummaryrefslogtreecommitdiffstats
path: root/g10/misc.c
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2005-07-22 16:28:40 +0000
committerWerner Koch <[email protected]>2005-07-22 16:28:40 +0000
commita486501c0b848b3de9bc355135f1ffec953e057f (patch)
treee5525626969c81afd367e72502f2830a229c3a97 /g10/misc.c
parent* options.h, g10.c (main), keyedit.c (keyedit_menu): Use --interactive (diff)
downloadgnupg-a486501c0b848b3de9bc355135f1ffec953e057f.tar.gz
gnupg-a486501c0b848b3de9bc355135f1ffec953e057f.zip
* gpg.sgml (http):
* g10.c, options.h: New option --exit-on-status-write-error. * status.c (write_status_text): Make use of this option.
Diffstat (limited to 'g10/misc.c')
-rw-r--r--g10/misc.c25
1 files changed, 15 insertions, 10 deletions
diff --git a/g10/misc.c b/g10/misc.c
index 0bf71c264..9f412f3de 100644
--- a/g10/misc.c
+++ b/g10/misc.c
@@ -1155,24 +1155,29 @@ get_libexecdir (void)
{
#ifdef HAVE_W32_SYSTEM
static int got_dir;
- static char *dir;
+ static char dir[MAX_PATH+5];
if (!got_dir)
{
- dir = read_w32_registry_string ("HKEY_LOCAL_MACHINE",
- "Software\\GNU\\GnuPG",
- "Install Directory");
- if (dir && !*dir)
+ char *p;
+
+ if ( !GetModuleFileName ( NULL, dir, MAX_PATH) )
{
- /* To avoid problems with using an empty dir we don't allow
- for that. */
- free (dir);
- dir = NULL;
+ log_debug ("GetModuleFileName failed: %s\n", w32_strerror (0));
+ *dir = 0;
}
got_dir = 1;
+ p = strrchr (dir, DIRSEP_C);
+ if (p)
+ *p = 0;
+ else
+ {
+ log_debug ("bad filename `%s' returned for this process\n", dir);
+ *dir = 0;
+ }
}
- if (dir)
+ if (*dir)
return dir;
/* Fallback to the hardwired value. */
#endif /*HAVE_W32_SYSTEM*/