* 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 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_
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;
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)
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;
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;