Fixed version string and W32 spawn function
This commit is contained in:
parent
3a8df5d469
commit
6e9b15d7ed
@ -1,5 +1,9 @@
|
||||
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.
|
||||
|
@ -219,11 +219,13 @@ get_engine_info (void)
|
||||
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;
|
||||
@ -250,15 +252,17 @@ get_engine_info (void)
|
||||
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;
|
||||
}
|
||||
@ -267,8 +271,29 @@ get_engine_info (void)
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
@ -484,9 +484,9 @@ _gpgme_io_spawn ( const char *path, char **argv,
|
||||
}
|
||||
}
|
||||
|
||||
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 */
|
||||
|
@ -99,10 +99,10 @@ _gpgme_get_gpg_path (void)
|
||||
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 {
|
||||
|
Loading…
Reference in New Issue
Block a user