diff options
Diffstat (limited to 'sm/keydb.c')
-rw-r--r-- | sm/keydb.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/sm/keydb.c b/sm/keydb.c index 38737c96a..512ab1af8 100644 --- a/sm/keydb.c +++ b/sm/keydb.c @@ -161,10 +161,17 @@ gpgsm_keydb_deinit_session_data (ctrl_t ctrl) log_error ("oops: trying to cleanup an active keydb context\n"); else { - kbx_client_data_release (kbl->kcd); - kbl->kcd = NULL; assuan_release (kbl->ctx); kbl->ctx = NULL; + /* + * Since there may be pipe output FD sent to the server (so + * that it can receive data through the pipe), we should + * release the assuan connection before releasing KBL->KCD. + * This way, the data receiving thread can finish cleanly, + * and we can join the thread. + */ + kbx_client_data_release (kbl->kcd); + kbl->kcd = NULL; } xfree (kbl); } @@ -516,7 +523,8 @@ create_new_context (ctrl_t ctrl, assuan_context_t *r_ctx) err = start_new_keyboxd (&ctx, GPG_ERR_SOURCE_DEFAULT, opt.keyboxd_program, - opt.autostart, opt.verbose, DBG_IPC, + opt.autostart?ASSHELP_FLAG_AUTOSTART:0, + opt.verbose, DBG_IPC, NULL, ctrl); if (!opt.autostart && gpg_err_code (err) == GPG_ERR_NO_KEYBOXD) { @@ -580,7 +588,7 @@ open_context (ctrl_t ctrl, keydb_local_t *r_kbl) return err; } - err = kbx_client_data_new (&kbl->kcd, kbl->ctx, 1); + err = kbx_client_data_new (&kbl->kcd, kbl->ctx, 0); if (err) { assuan_release (kbl->ctx); |