[PATCH] gpgme-tool: Initialize invalid input_fd and output_fd

W. Trevor King wking at tremily.us
Thu Sep 27 01:26:00 CEST 2012


* src/gpgme-tool.c (gpgme_server): Initialize input_fd and output_fd
to ASSUAN_INVALID_FD.  Otherwise input and output may both try to open
file descriptor 0.

Signed-off-by: W. Trevor King <wking at tremily.us>
---

On Wed, Sep 26, 2012 at 09:01:31AM +0200, Werner Koch wrote:
> On Tue, 25 Sep 2012 20:33, wking at tremily.us said:
> > `std_handler_output` in `src/assuan-handler.c`).  The default handlers
> > should already do the right thing.  If we need filename/encoding
> > handlers, can we move that over to libassuan?
> 
> No we can't because that is application specific.

Wanting to avoid file descriptors and use filenames is application
specific?  Ahh, I see the (undocumented?) encoding options *are*
GPGME-specific.

On Wed, Sep 26, 2012 at 09:39:45AM +0200, Werner Koch wrote:
> here is a patch which should solve the bug.

I checked this with pgp-mime and it almost works for me.  I'm
submitting this supplemental patch, after which pgp-mime passes all
its unit tests again.

 src/gpgme-tool.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/src/gpgme-tool.c b/src/gpgme-tool.c
index 3a02065..19dedb6 100644
--- a/src/gpgme-tool.c
+++ b/src/gpgme-tool.c
@@ -3121,6 +3121,8 @@ gpgme_server (gpgme_tool_t gt)
   static const char hello[] = ("GPGME-Tool " VERSION " ready");
 
   memset (&server, 0, sizeof (server));
+  server.input_fd = ASSUAN_INVALID_FD;
+  server.output_fd = ASSUAN_INVALID_FD;
   server.message_fd = ASSUAN_INVALID_FD;
   server.input_enc = GPGME_DATA_ENCODING_NONE;
   server.output_enc = GPGME_DATA_ENCODING_NONE;
-- 
1.7.8.6

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: OpenPGP digital signature
URL: </pipermail/attachments/20120926/0cf6751a/attachment.pgp>


More information about the Gnupg-devel mailing list