aboutsummaryrefslogtreecommitdiffstats
path: root/kbx/kbxserver.c
diff options
context:
space:
mode:
Diffstat (limited to 'kbx/kbxserver.c')
-rw-r--r--kbx/kbxserver.c26
1 files changed, 12 insertions, 14 deletions
diff --git a/kbx/kbxserver.c b/kbx/kbxserver.c
index ae9ae5c75..d09a8f8eb 100644
--- a/kbx/kbxserver.c
+++ b/kbx/kbxserver.c
@@ -131,21 +131,25 @@ get_assuan_ctx_from_ctrl (ctrl_t ctrl)
static gpg_error_t
prepare_outstream (ctrl_t ctrl)
{
- int fd;
+ gnupg_fd_t fd;
+ estream_t out_fp = NULL;
log_assert (ctrl && ctrl->server_local);
if (ctrl->server_local->outstream)
return 0; /* Already enabled. */
- fd = translate_sys2libc_fd
- (assuan_get_output_fd (get_assuan_ctx_from_ctrl (ctrl)), 1);
- if (fd == -1)
+ fd = assuan_get_output_fd (get_assuan_ctx_from_ctrl (ctrl));
+ if (fd == GNUPG_INVALID_FD)
return 0; /* No Output command active. */
+ else
+ {
+ out_fp = open_stream_nc (fd, "w");
+ if (!out_fp)
+ return gpg_err_code_from_syserror ();
+ }
- ctrl->server_local->outstream = es_fdopen_nc (fd, "w");
- if (!ctrl->server_local->outstream)
- return gpg_err_code_from_syserror ();
+ ctrl->server_local->outstream = out_fp;
return 0;
}
@@ -946,15 +950,9 @@ kbxd_start_command_handler (ctrl_t ctrl, gnupg_fd_t fd, unsigned int session_id)
}
else
{
- /* The fd-passing does not work reliable on Windows, and even it
- * it is not used by gpg and gpgsm the current libassuan slows
- * down things if it is allowed for the server.*/
rc = assuan_init_socket_server (ctx, fd,
(ASSUAN_SOCKET_SERVER_ACCEPTED
-#ifndef HAVE_W32_SYSTEM
- |ASSUAN_SOCKET_SERVER_FDPASSING
-#endif
- ));
+ |ASSUAN_SOCKET_SERVER_FDPASSING));
}
if (rc)