aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNIIBE Yutaka <[email protected]>2016-06-15 09:44:35 +0000
committerWerner Koch <[email protected]>2016-06-15 09:44:35 +0000
commit28fd0ab40739e8cb73f208e30f78d8aa7a0a6d19 (patch)
treeab2194d448861ba0e1d7a32ed005e9f3f93f4c28
parentAdjust memory limit of es_fopenmem to the block size. (diff)
downloadlibgpg-error-28fd0ab40739e8cb73f208e30f78d8aa7a0a6d19.tar.gz
libgpg-error-28fd0ab40739e8cb73f208e30f78d8aa7a0a6d19.zip
estream: Fix assertion failure due to es_flush.
* src/estream.c (es_writen): Set writing flag even if no data was written. -- GnuPG-bug-id: 2371 Signed-off-by: Werner Koch <[email protected]> gniibe tracked the problem down to a fully valid change in GnuPG (gnupg commit 12af2630cf4d1a39179179925fac8f2cce7504ff). He wrote: This is the first instance for estream to do READ and WRITE (in the history of the code > 10 years :-). In the [gnupg] function agent_write_private_key, the pattern is: es_fopen es_fread es_fseek es_fwrite which should work well, but if results core dump by assertion failure in the function es_flush of libgpg-error.
-rw-r--r--src/estream.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/src/estream.c b/src/estream.c
index 2033b23..e382a29 100644
--- a/src/estream.c
+++ b/src/estream.c
@@ -2679,6 +2679,7 @@ es_writen (estream_t _GPGRT__RESTRICT stream,
else
goto out;
}
+ stream->flags.writing = 1;
}
}
@@ -2701,9 +2702,6 @@ es_writen (estream_t _GPGRT__RESTRICT stream,
if (bytes_written)
*bytes_written = data_written;
- if (data_written)
- if (!stream->flags.writing)
- stream->flags.writing = 1;
return err;
}