[gpgme] change work dir
Marcus Brinkmann
marcus.brinkmann at ruhr-uni-bochum.de
Sun Dec 12 15:58:32 CET 2004
At Sat, 11 Dec 2004 15:35:42 +0100,
micron <micron at madlab.it> wrote:
> a.out: engine.c:308: _gpgme_set_engine_info: Assertion `file_name' failed.
> Aborted
Excellent, you found a bug ;)
> - assert (file_name);
> - new_file_name = strdup (new_file_name);
> + assert (new_file_name);
> + file_name = strdup (new_file_name);
Only the assert change is correct, the second change is incorrect.
Try this patch instead (already checked in)
2004-12-12 Marcus Brinkmann <marcus at g10code.de>
* engine.c (_gpgme_set_engine_info): Fix assertion.
--- engine.c 7 Dec 2004 21:13:36 -0000 1.46
+++ engine.c 12 Dec 2004 14:55:55 -0000
@@ -305,7 +305,7 @@ _gpgme_set_engine_info (gpgme_engine_inf
else
{
new_file_name = engine_get_file_name (proto);
- assert (file_name);
+ assert (new_file_name);
new_file_name = strdup (new_file_name);
}
if (!new_file_name)
> With a little debug I found that the signal SIGSEGV is raised into
> engine.c:130
> free (info->file_name)
> at the second iteration.
> info->file_name seems correct, I wasn't able to discover the real problem.
This is due to you not storing a pointer to allocated memory in
new_file_name above, but a pointer to statically allocated memory
(new_file_name is what ends up in info->file_name, and not file_name.
The reason I use a different variable new_file_name is so that
file_name can be const).
I didn't try your test program with my fix, but I am sure you will ;)
Thanks,
Marcus
More information about the Gnupg-devel
mailing list