Incorrect gpgme_wait behavior

Marcus Brinkmann marcus.brinkmann at ruhr-uni-bochum.de
Thu Apr 14 10:33:09 CEST 2005


At Tue, 29 Mar 2005 18:59:53 -0500,
Igor Belyi <gpgme at katehok.ac93.org> wrote:
> 
> [1  <text/plain; ISO-8859-1 (7bit)>]
> Hello,
> 
> gpgme_wait(ctx, &status, 0) on timeout returns ctx instead of NULL which
> makes it difficult to distinguish from a program return when ctx in not NULL.
> Plus, on timeout status is unchanged instead of being forced into 0.
> As a work around I set status to 0xFFFF (an impossible error code)
> and check if it got changed during the call.

Good spot.  I checked in a slightly different patch, which should do
the same as yours (but doesn't modify ctx_wait and checks if status is
not NULL).

Thanks,
Marcus

2005-04-14  Marcus Brinkmann  <marcus at g10code.de>

        * wait-global.c (gpgme_wait): If no context is found, and we
        should not hang, set *status to 0 and return NULL.
        Reported by Igor Belyi <gpgme at katehok.ac93.org>.

diff -u -r1.12 wait-global.c
--- wait-global.c	24 Mar 2005 13:05:12 -0000	1.12
+++ wait-global.c	14 Apr 2005 08:40:24 -0000
@@ -350,6 +350,12 @@
 	    ctx = dctx;
 	    hang = 0;
 	  }
+	else if (!hang)
+	  {
+	    ctx = NULL;
+	    if (status)
+	      *status = 0;
+	  }
       }
     }
   while (hang);




More information about the Gnupg-devel mailing list