mirror of
git://git.gnupg.org/gnupg.git
synced 2024-12-31 11:41:32 +01:00
kbx: Use es_sysopen_nc instead of es_fdopen_nc.
* kbx/kbxserver.c (prepare_outstream): Use es_sysopen_nc and avoid the use of translate_sys2libc_fd. -- On Windows, it's better directly use the system HANDLE. Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
This commit is contained in:
parent
f2dcd158a5
commit
2abea42d9c
@ -131,21 +131,34 @@ get_assuan_ctx_from_ctrl (ctrl_t ctrl)
|
|||||||
static gpg_error_t
|
static gpg_error_t
|
||||||
prepare_outstream (ctrl_t ctrl)
|
prepare_outstream (ctrl_t ctrl)
|
||||||
{
|
{
|
||||||
int fd;
|
gnupg_fd_t fd;
|
||||||
|
estream_t out_fp = NULL;
|
||||||
|
|
||||||
log_assert (ctrl && ctrl->server_local);
|
log_assert (ctrl && ctrl->server_local);
|
||||||
|
|
||||||
if (ctrl->server_local->outstream)
|
if (ctrl->server_local->outstream)
|
||||||
return 0; /* Already enabled. */
|
return 0; /* Already enabled. */
|
||||||
|
|
||||||
fd = translate_sys2libc_fd
|
fd = assuan_get_output_fd (get_assuan_ctx_from_ctrl (ctrl));
|
||||||
(assuan_get_output_fd (get_assuan_ctx_from_ctrl (ctrl)), 1);
|
if (fd == GNUPG_INVALID_FD)
|
||||||
if (fd == -1)
|
|
||||||
return 0; /* No Output command active. */
|
return 0; /* No Output command active. */
|
||||||
|
else
|
||||||
|
{
|
||||||
|
es_syshd_t syshd;
|
||||||
|
|
||||||
ctrl->server_local->outstream = es_fdopen_nc (fd, "w");
|
#ifdef HAVE_W32_SYSTEM
|
||||||
if (!ctrl->server_local->outstream)
|
syshd.type = ES_SYSHD_HANDLE;
|
||||||
return gpg_err_code_from_syserror ();
|
syshd.u.handle = fd;
|
||||||
|
#else
|
||||||
|
syshd.type = ES_SYSHD_FD;
|
||||||
|
syshd.u.fd = fd;
|
||||||
|
#endif
|
||||||
|
out_fp = es_sysopen_nc (&syshd, "w");
|
||||||
|
if (!out_fp)
|
||||||
|
return gpg_err_code_from_syserror ();
|
||||||
|
}
|
||||||
|
|
||||||
|
ctrl->server_local->outstream = out_fp;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user