[git] GPGME - branch, master, updated. gpgme-1.8.0-36-g6f02133

by Justus Winter cvs at cvs.gnupg.org
Mon Jan 23 15:20:17 CET 2017


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GnuPG Made Easy".

The branch, master has been updated
       via  6f02133bb07726afa6950e5b4685e75621276e60 (commit)
      from  ca69df8c8d3f044340aee2a118cc20d33cd600a1 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 6f02133bb07726afa6950e5b4685e75621276e60
Author: Justus Winter <justus at g10code.com>
Date:   Mon Jan 23 15:08:23 2017 +0100

    w32: Fix closing file descriptors.
    
    * src/w32-io.c (writer): Only stop once the buffer is drained.
    (destroy_writer): Wait for the writers buffer to be drained.  This
    aligns '_gpgme_io_close's behavior with close(2) and fclose(3).
    
    GnuPG-bug-id: 2881
    Signed-off-by: Justus Winter <justus at g10code.com>

diff --git a/src/w32-io.c b/src/w32-io.c
index 0d1c810..6302ad9 100644
--- a/src/w32-io.c
+++ b/src/w32-io.c
@@ -700,7 +700,7 @@ writer (void *arg)
   for (;;)
     {
       LOCK (ctx->mutex);
-      if (ctx->stop_me)
+      if (ctx->stop_me && !ctx->nbytes)
 	{
 	  UNLOCK (ctx->mutex);
 	  break;
@@ -717,7 +717,7 @@ writer (void *arg)
 	  TRACE_LOG ("got data to send");
 	  LOCK (ctx->mutex);
        	}
-      if (ctx->stop_me)
+      if (ctx->stop_me && !ctx->nbytes)
 	{
 	  UNLOCK (ctx->mutex);
 	  break;
@@ -776,6 +776,9 @@ writer (void *arg)
   TRACE_LOG ("waiting for close");
   WaitForSingleObject (ctx->close_ev, INFINITE);
 
+  if (ctx->nbytes)
+    TRACE_LOG1 ("still %d bytes in buffer at close time", ctx->nbytes);
+
   CloseHandle (ctx->close_ev);
   CloseHandle (ctx->have_data);
   CloseHandle (ctx->is_empty);
@@ -892,6 +895,9 @@ destroy_writer (struct writer_context_s *ctx)
     SetEvent (ctx->have_data);
   UNLOCK (ctx->mutex);
 
+  /* Give the writer a chance to flush the buffer.  */
+  WaitForSingleObject (ctx->is_empty, INFINITE);
+
 #ifdef HAVE_W32CE_SYSTEM
   /* Scenario: We never create a full pipe, but already started
      writing more than the pipe buffer.  Then we need to unblock the

-----------------------------------------------------------------------

Summary of changes:
 src/w32-io.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)


hooks/post-receive
-- 
GnuPG Made Easy
http://git.gnupg.org




More information about the Gnupg-commits mailing list