mirror of
git://git.gnupg.org/gnupg.git
synced 2024-12-22 10:19:57 +01:00
kbx: Fix error paths to fall back to D-lines.
* kbx/kbx-client-util.c (prepare_data_pipe): Return an error. (kbx_client_data_new): Recover from an error by use of D-lines. (kbx_client_data_release): Handle the case of use of D-lines. -- Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
This commit is contained in:
parent
6e2412e74a
commit
eceba4f207
@ -129,7 +129,7 @@ prepare_data_pipe (kbx_client_data_t kcd)
|
|||||||
inpipe[1], gpg_strerror (err), gpg_strsource (err));
|
inpipe[1], gpg_strerror (err), gpg_strsource (err));
|
||||||
es_fclose (infp);
|
es_fclose (infp);
|
||||||
gnupg_close_pipe (inpipe[1]);
|
gnupg_close_pipe (inpipe[1]);
|
||||||
return 0; /* Server may not support fd-passing. */
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
err = assuan_transact (kcd->ctx, "OUTPUT FD",
|
err = assuan_transact (kcd->ctx, "OUTPUT FD",
|
||||||
@ -139,13 +139,12 @@ prepare_data_pipe (kbx_client_data_t kcd)
|
|||||||
log_info ("keyboxd does not accept our fd: %s <%s>\n",
|
log_info ("keyboxd does not accept our fd: %s <%s>\n",
|
||||||
gpg_strerror (err), gpg_strsource (err));
|
gpg_strerror (err), gpg_strsource (err));
|
||||||
es_fclose (infp);
|
es_fclose (infp);
|
||||||
return 0;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
close (inpipe[1]);
|
close (inpipe[1]);
|
||||||
kcd->fp = infp;
|
kcd->fp = infp;
|
||||||
|
|
||||||
|
|
||||||
rc = npth_attr_init (&tattr);
|
rc = npth_attr_init (&tattr);
|
||||||
if (rc)
|
if (rc)
|
||||||
{
|
{
|
||||||
@ -295,8 +294,7 @@ kbx_client_data_new (kbx_client_data_t *r_kcd, assuan_context_t ctx,
|
|||||||
{
|
{
|
||||||
err = gpg_error_from_errno (rc);
|
err = gpg_error_from_errno (rc);
|
||||||
log_error ("error initializing mutex: %s\n", gpg_strerror (err));
|
log_error ("error initializing mutex: %s\n", gpg_strerror (err));
|
||||||
xfree (kcd);
|
goto leave; /* Use D-lines. */
|
||||||
return err;
|
|
||||||
}
|
}
|
||||||
rc = npth_cond_init (&kcd->cond, NULL);
|
rc = npth_cond_init (&kcd->cond, NULL);
|
||||||
if (rc)
|
if (rc)
|
||||||
@ -304,8 +302,7 @@ kbx_client_data_new (kbx_client_data_t *r_kcd, assuan_context_t ctx,
|
|||||||
err = gpg_error_from_errno (rc);
|
err = gpg_error_from_errno (rc);
|
||||||
log_error ("error initializing condition: %s\n", gpg_strerror (err));
|
log_error ("error initializing condition: %s\n", gpg_strerror (err));
|
||||||
npth_mutex_destroy (&kcd->mutex);
|
npth_mutex_destroy (&kcd->mutex);
|
||||||
xfree (kcd);
|
goto leave; /* Use D-lines. */
|
||||||
return err;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
err = prepare_data_pipe (kcd);
|
err = prepare_data_pipe (kcd);
|
||||||
@ -313,8 +310,7 @@ kbx_client_data_new (kbx_client_data_t *r_kcd, assuan_context_t ctx,
|
|||||||
{
|
{
|
||||||
npth_cond_destroy (&kcd->cond);
|
npth_cond_destroy (&kcd->cond);
|
||||||
npth_mutex_destroy (&kcd->mutex);
|
npth_mutex_destroy (&kcd->mutex);
|
||||||
xfree (kcd);
|
/* Use D-lines. */
|
||||||
return err;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
leave:
|
leave:
|
||||||
@ -331,10 +327,16 @@ kbx_client_data_release (kbx_client_data_t kcd)
|
|||||||
if (!kcd)
|
if (!kcd)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
fp = kcd->fp;
|
||||||
|
if (!fp)
|
||||||
|
{
|
||||||
|
xfree (kcd);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (npth_join (kcd->thd, NULL))
|
if (npth_join (kcd->thd, NULL))
|
||||||
log_error ("kbx_client_data_release failed on npth_join");
|
log_error ("kbx_client_data_release failed on npth_join");
|
||||||
|
|
||||||
fp = kcd->fp;
|
|
||||||
kcd->fp = NULL;
|
kcd->fp = NULL;
|
||||||
es_fclose (fp);
|
es_fclose (fp);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user