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>
|
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.
|
* posix-util.c, w32-util.c: New.
|
||||||
(_gpgme_get_gpg_path): New, suggested by Jan-Oliver.
|
(_gpgme_get_gpg_path): New, suggested by Jan-Oliver.
|
||||||
* rungpg.c (_gpgme_gpg_spawn): Use new function to get GPG's path.
|
* 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;
|
const char *engine_info =NULL;
|
||||||
GpgmeCtx c = NULL;
|
GpgmeCtx c = NULL;
|
||||||
GpgmeError err = 0;
|
GpgmeError err = 0;
|
||||||
|
const char *path = NULL;
|
||||||
|
|
||||||
/* FIXME: make sure that only one instance does run */
|
/* FIXME: make sure that only one instance does run */
|
||||||
if (engine_info)
|
if (engine_info)
|
||||||
goto leave;
|
goto leave;
|
||||||
|
|
||||||
|
path = _gpgme_get_gpg_path ();
|
||||||
err = gpgme_new (&c);
|
err = gpgme_new (&c);
|
||||||
if (err)
|
if (err)
|
||||||
goto leave;
|
goto leave;
|
||||||
@ -250,15 +252,17 @@ get_engine_info (void)
|
|||||||
fmt = "<GnupgInfo>\n"
|
fmt = "<GnupgInfo>\n"
|
||||||
" <engine>\n"
|
" <engine>\n"
|
||||||
" <version>%s</version>\n"
|
" <version>%s</version>\n"
|
||||||
|
" <path>%s</path>\n"
|
||||||
" </engine>\n"
|
" </engine>\n"
|
||||||
"</GnupgInfo>\n";
|
"</GnupgInfo>\n";
|
||||||
/*(yes, I know that we allocating 2 extra bytes)*/
|
/*(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) {
|
if (!p) {
|
||||||
err = mk_error (Out_Of_Core);
|
err = mk_error (Out_Of_Core);
|
||||||
goto leave;
|
goto leave;
|
||||||
}
|
}
|
||||||
sprintf (p, fmt, tmp_engine_version);
|
sprintf (p, fmt, tmp_engine_version, path);
|
||||||
engine_info = p;
|
engine_info = p;
|
||||||
xfree (tmp_engine_version); tmp_engine_version = NULL;
|
xfree (tmp_engine_version); tmp_engine_version = NULL;
|
||||||
}
|
}
|
||||||
@ -267,8 +271,29 @@ get_engine_info (void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
leave:
|
leave:
|
||||||
if (err)
|
if (err) {
|
||||||
engine_info = "<GnupgInfo>\n<error>No engine</error>\n</GnupgInfo>\n";
|
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 );
|
gpgme_release ( c );
|
||||||
return engine_info;
|
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;
|
cr_flags |= CREATE_SUSPENDED;
|
||||||
if ( !CreateProcessA (GPG_PATH,
|
if ( !CreateProcessA (path,
|
||||||
arg_string,
|
arg_string,
|
||||||
&sec_attr, /* process security attributes */
|
&sec_attr, /* process security attributes */
|
||||||
&sec_attr, /* thread security attributes */
|
&sec_attr, /* thread security attributes */
|
||||||
|
@ -99,10 +99,10 @@ _gpgme_get_gpg_path (void)
|
|||||||
if (gpg_program) {
|
if (gpg_program) {
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
DEBUG1 ("found gpgProgram in registry: `%s'", gpgProgram );
|
DEBUG1 ("found gpgProgram in registry: `%s'", gpg_program );
|
||||||
for (i=0; gpg_program[i]; s++) {
|
for (i=0; gpg_program[i]; i++) {
|
||||||
if (gpg_program[i] == '/')
|
if (gpg_program[i] == '/')
|
||||||
gpg_program[i] == '\\';
|
gpg_program[i] = '\\';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
Loading…
Reference in New Issue
Block a user