From: Marcus Brinkmann Date: Tue, 24 Feb 2004 23:15:33 +0000 (+0000) Subject: 2004-02-25 Marcus Brinkmann X-Git-Tag: gpgme-0-4-5~7 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=d988a1820c05227409b8eb3c6713b947bfb3c04b;p=gpgme.git 2004-02-25 Marcus Brinkmann * 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. --- diff --git a/gpgme/ChangeLog b/gpgme/ChangeLog index 9000c17..e3eb8da 100644 --- a/gpgme/ChangeLog +++ b/gpgme/ChangeLog @@ -1,13 +1,20 @@ +2004-02-25 Marcus Brinkmann + + * 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 * 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 diff --git a/gpgme/engine-gpgsm.c b/gpgme/engine-gpgsm.c index 9981255..f2e5151 100644 --- a/gpgme/engine-gpgsm.c +++ b/gpgme/engine-gpgsm.c @@ -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; } diff --git a/gpgme/rungpg.c b/gpgme/rungpg.c index 58c12f9..7cb4ae7 100644 --- a/gpgme/rungpg.c +++ b/gpgme/rungpg.c @@ -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 };