2002-06-11 Marcus Brinkmann <marcus@g10code.de>

* engine-gpgsm.c (_gpgme_gpgsm_release): Close status_cb.fd.
	(_gpgme_gpgsm_new): Duplicate status file descriptor, so we can
	use our own close notification mechanism without interfering with
	assuan.
This commit is contained in:
Marcus Brinkmann 2002-06-11 18:12:19 +00:00
parent 6b89172051
commit 14f16305b0
3 changed files with 25 additions and 1 deletions

View File

@ -1,3 +1,10 @@
2002-06-11 Marcus Brinkmann <marcus@g10code.de>
* engine-gpgsm.c (_gpgme_gpgsm_release): Close status_cb.fd.
(_gpgme_gpgsm_new): Duplicate status file descriptor, so we can
use our own close notification mechanism without interfering with
assuan.
2002-06-11 Werner Koch <wk@gnupg.org>
* gpgme.h: Add GPGME_ATTR_SIG_SUMMARY and the GPGME_SIGSUM_

View File

@ -381,7 +381,17 @@ _gpgme_gpgsm_new (GpgsmObject *r_gpgsm)
err = mk_error (General_Error); /* FIXME */
goto leave;
}
gpgsm->status_cb.fd = fdlist[0];
/* We duplicate the file descriptor, so we can close it without
disturbing assuan. Alternatively, we could special case
status_fd and register/unregister it manually as needed, but this
increases code duplication and is more complicated as we can not
use the close notifications etc. */
gpgsm->status_cb.fd = dup (fdlist[0]);
if (gpgsm->status_cb.fd < 0)
{
err = mk_error (General_Error); /* FIXME */
goto leave;
}
gpgsm->status_cb.dir = 1;
gpgsm->status_cb.data = gpgsm;
@ -516,6 +526,8 @@ _gpgme_gpgsm_release (GpgsmObject gpgsm)
if (!gpgsm)
return;
if (gpgsm->status_cb.fd != -1)
_gpgme_io_close (gpgsm->status_cb.fd);
if (gpgsm->input_cb.fd != -1)
_gpgme_io_close (gpgsm->input_cb.fd);
if (gpgsm->output_cb.fd != -1)

View File

@ -1074,6 +1074,9 @@ read_status ( GpgObject gpg )
if ( r->code == STATUS_END_STREAM ) {
if (gpg->cmd.used)
{
/* XXX We must check if there are any
more fds active after removing this
one. */
(*gpg->io_cbs.remove)
(gpg->fd_data_map[gpg->cmd.idx].tag);
gpg->cmd.fd = gpg->fd_data_map[gpg->cmd.idx].fd;
@ -1335,6 +1338,8 @@ command_cb (void *opaque, char *buffer, size_t length, size_t *nread)
gpg->cmd.fnc (gpg->cmd.fnc_value, 0, value);
gpg->cmd.code = 0;
/* And sleep again until read_status will wake us up again. */
/* XXX We must check if there are any more fds active after removing
this one. */
(*gpg->io_cbs.remove) (gpg->fd_data_map[gpg->cmd.idx].tag);
gpg->cmd.fd = gpg->fd_data_map[gpg->cmd.idx].fd;
gpg->fd_data_map[gpg->cmd.idx].fd = -1;