2004-02-25 Marcus Brinkmann <marcus@g10code.de>

* rungpg.c (gpg_cancel): New function.
	(gpg_release): Call it here.
	(_gpgme_engine_ops_gpg): Add it here.
	* engine-gpgsm.c (gpgsm_cancel): Fix last change.
This commit is contained in:
Marcus Brinkmann 2004-02-24 23:15:33 +00:00
parent ed314ff766
commit d988a1820c
3 changed files with 39 additions and 16 deletions

View File

@ -1,13 +1,20 @@
2004-02-25 Marcus Brinkmann <marcus@g10code.de>
* rungpg.c (gpg_cancel): New function.
(gpg_release): Call it here.
(_gpgme_engine_ops_gpg): Add it here.
* engine-gpgsm.c (gpgsm_cancel): Fix last change.
2004-02-24 Marcus Brinkmann <marcus@g10code.de>
* gpgme.c (gpgme_cancel): New function.
* engine-backend.h (struct engine_ops): New member cancel.
* engine.h (_gpgme_engine_cancel): New prototype.
* engine.c (_gpgme_engine_cancel): New function.
* engine-gpgsm.c: Add new member cancel.
* engine-gpgsm.c (_gpgme_engine_ops_gpgsm): Add new member cancel.
(gpgsm_cancel): New function.
(gpgsm_release): Use it.
* rungpg.c: Add new member cancel.
* rungpg.c (_gpgme_engine_ops_gpg): Add new member cancel.
2004-02-17 Werner Koch <wk@gnupg.org>

View File

@ -278,7 +278,7 @@ gpgsm_cancel (void *engine)
engine_gpgsm_t gpgsm = engine;
if (!gpgsm)
return;
return gpg_error (GPG_ERR_INV_VALUE);
if (gpgsm->status_cb.fd != -1)
_gpgme_io_close (gpgsm->status_cb.fd);
@ -290,6 +290,8 @@ gpgsm_cancel (void *engine)
_gpgme_io_close (gpgsm->message_cb.fd);
assuan_disconnect (gpgsm->assuan_ctx);
return 0;
}

View File

@ -276,6 +276,30 @@ free_fd_data_map (struct fd_data_map_s *fd_data_map)
}
static gpgme_error_t
gpg_cancel (void *engine)
{
engine_gpg_t gpg = engine;
if (!gpg)
return gpg_error (GPG_ERR_INV_VALUE);
if (gpg->status.fd[0] != -1)
_gpgme_io_close (gpg->status.fd[0]);
if (gpg->status.fd[1] != -1)
_gpgme_io_close (gpg->status.fd[1]);
if (gpg->colon.fd[0] != -1)
_gpgme_io_close (gpg->colon.fd[0]);
if (gpg->colon.fd[1] != -1)
_gpgme_io_close (gpg->colon.fd[1]);
if (gpg->fd_data_map)
free_fd_data_map (gpg->fd_data_map);
if (gpg->cmd.fd != -1)
_gpgme_io_close (gpg->cmd.fd);
return 0;
}
static void
gpg_release (void *engine)
{
@ -284,6 +308,8 @@ gpg_release (void *engine)
if (!gpg)
return;
gpg_cancel (engine);
while (gpg->arglist)
{
struct arg_and_data_s *next = gpg->arglist->next;
@ -302,18 +328,6 @@ gpg_release (void *engine)
if (gpg->cmd.keyword)
free (gpg->cmd.keyword);
if (gpg->status.fd[0] != -1)
_gpgme_io_close (gpg->status.fd[0]);
if (gpg->status.fd[1] != -1)
_gpgme_io_close (gpg->status.fd[1]);
if (gpg->colon.fd[0] != -1)
_gpgme_io_close (gpg->colon.fd[0]);
if (gpg->colon.fd[1] != -1)
_gpgme_io_close (gpg->colon.fd[1]);
if (gpg->fd_data_map)
free_fd_data_map (gpg->fd_data_map);
if (gpg->cmd.fd != -1)
_gpgme_io_close (gpg->cmd.fd);
free (gpg);
}
@ -1665,5 +1679,5 @@ struct engine_ops _gpgme_engine_ops_gpg =
gpg_verify,
gpg_set_io_cbs,
gpg_io_event,
NULL
gpg_cancel
};