Tricky gpgme_wait bug.

Marcus Brinkmann marcus.brinkmann at
Fri Jun 3 00:53:44 CEST 2005

At Mon, 25 Apr 2005 13:51:58 -0400,
Igor Belyi <gpgme at> wrote:
> > The extra sleep between gpgme_wait causes _gpgme_io_select to get 
> > signal on more than one file handler for the same context. As a result 
> > an error reported on the first handle causes all context handlers to 
> > be closed and the associated data released. When the second selected 
> > handle get processed it causes segmentation fault.
> And just to reply to myself, attached is a proposed patch fixing the 
> problem.


I have committed a simpler fix to CVS HEAD and the 1.0 branch: Just
break out of the loop, and go to the next iteration of the select()
(which will terminate as there are no more fds to select on).

I have also added a test case based on the one you sent us, and it
does no longer segfault.

2005-06-03  Marcus Brinkmann  <marcus at>

        * wait-global.c (gpgme_wait): Break out of the fd processing loop
        after an error.
        Reported by Igor Belyi <gpgme at>.

2005-06-03  Marcus Brinkmann  <marcus at>

        * gpg/ (TESTS): Add t-wait.
        * gpg/t-wait.c (main): New test.


More information about the Gnupg-devel mailing list