2001-01-30 Werner Koch <wk@gnupg.org>
+ * w32-io.c (_gpgme_io_spawn): Use the supplied path arg.
+
+ * version.c (get_engine_info): Return better error information.
+
* posix-util.c, w32-util.c: New.
(_gpgme_get_gpg_path): New, suggested by Jan-Oliver.
* rungpg.c (_gpgme_gpg_spawn): Use new function to get GPG's path.
const char *engine_info =NULL;
GpgmeCtx c = NULL;
GpgmeError err = 0;
+ const char *path = NULL;
/* FIXME: make sure that only one instance does run */
if (engine_info)
goto leave;
+ path = _gpgme_get_gpg_path ();
err = gpgme_new (&c);
if (err)
goto leave;
fmt = "<GnupgInfo>\n"
" <engine>\n"
" <version>%s</version>\n"
+ " <path>%s</path>\n"
" </engine>\n"
"</GnupgInfo>\n";
/*(yes, I know that we allocating 2 extra bytes)*/
- p = xtrymalloc ( strlen(fmt) + strlen (tmp_engine_version) + 1);
+ p = xtrymalloc ( strlen(fmt) + strlen(path)
+ + strlen (tmp_engine_version) + 1);
if (!p) {
err = mk_error (Out_Of_Core);
goto leave;
}
- sprintf (p, fmt, tmp_engine_version);
+ sprintf (p, fmt, tmp_engine_version, path);
engine_info = p;
xfree (tmp_engine_version); tmp_engine_version = NULL;
}
}
leave:
- if (err)
- engine_info = "<GnupgInfo>\n<error>No engine</error>\n</GnupgInfo>\n";
+ if (err) {
+ const char *fmt;
+ const char *errstr = gpgme_strerror (err);
+ char *p;
+
+ fmt = "<GnupgInfo>\n"
+ " <engine>\n"
+ " <error>%s</error>\n"
+ " <path>%s</path>\n"
+ " </engine>\n"
+ "</GnupgInfo>\n";
+
+ p = xtrymalloc ( strlen(fmt) + strlen(errstr) + strlen(path) + 1);
+ if (p) {
+ sprintf (p, fmt, errstr, path);
+ engine_info = p;
+ }
+ else {
+ engine_info = "<GnupgInfo>\n"
+ " <error>Out of core</error>\n"
+ "</GnupgInfo>\n";
+ }
+ }
gpgme_release ( c );
return engine_info;
}
}
}
- DEBUG1 ("CreateProcess, args=`%s'", arg_string);
+ DEBUG2 ("CreateProcess, path=`%s' args=`%s'", path, arg_string);
cr_flags |= CREATE_SUSPENDED;
- if ( !CreateProcessA (GPG_PATH,
+ if ( !CreateProcessA (path,
arg_string,
&sec_attr, /* process security attributes */
&sec_attr, /* thread security attributes */
if (gpg_program) {
int i;
- DEBUG1 ("found gpgProgram in registry: `%s'", gpgProgram );
- for (i=0; gpg_program[i]; s++) {
+ DEBUG1 ("found gpgProgram in registry: `%s'", gpg_program );
+ for (i=0; gpg_program[i]; i++) {
if (gpg_program[i] == '/')
- gpg_program[i] == '\\';
+ gpg_program[i] = '\\';
}
}
else {