mirror of
git://git.gnupg.org/gnupg.git
synced 2024-12-22 10:19:57 +01:00
sm: Use gnupg_fd_t and open_stream_nc for assuan_get_input_fd.
* sm/server.c (cmd_genkey): Use open_stream_nc for input and output. (cmd_getauditlog): Use open_stream_nc for output. -- GnuPG-bug-id: 6580 Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
This commit is contained in:
parent
fb046ccd93
commit
69c1d81284
22
sm/server.c
22
sm/server.c
@ -1090,24 +1090,24 @@ static gpg_error_t
|
|||||||
cmd_genkey (assuan_context_t ctx, char *line)
|
cmd_genkey (assuan_context_t ctx, char *line)
|
||||||
{
|
{
|
||||||
ctrl_t ctrl = assuan_get_pointer (ctx);
|
ctrl_t ctrl = assuan_get_pointer (ctx);
|
||||||
int inp_fd, out_fd;
|
gnupg_fd_t inp_fd, out_fd;
|
||||||
estream_t in_stream, out_stream;
|
estream_t in_stream, out_stream;
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
(void)line;
|
(void)line;
|
||||||
|
|
||||||
inp_fd = translate_sys2libc_fd (assuan_get_input_fd (ctx), 0);
|
inp_fd = assuan_get_input_fd (ctx);
|
||||||
if (inp_fd == -1)
|
if (inp_fd == GNUPG_INVALID_FD)
|
||||||
return set_error (GPG_ERR_ASS_NO_INPUT, NULL);
|
return set_error (GPG_ERR_ASS_NO_INPUT, NULL);
|
||||||
out_fd = translate_sys2libc_fd (assuan_get_output_fd (ctx), 1);
|
out_fd = assuan_get_output_fd (ctx);
|
||||||
if (out_fd == -1)
|
if (out_fd == GNUPG_INVALID_FD)
|
||||||
return set_error (GPG_ERR_ASS_NO_OUTPUT, NULL);
|
return set_error (GPG_ERR_ASS_NO_OUTPUT, NULL);
|
||||||
|
|
||||||
in_stream = es_fdopen_nc (inp_fd, "r");
|
in_stream = open_stream_nc (inp_fd, "r");
|
||||||
if (!in_stream)
|
if (!in_stream)
|
||||||
return set_error (GPG_ERR_ASS_GENERAL, "es_fdopen failed");
|
return set_error (GPG_ERR_ASS_GENERAL, "es_fdopen failed");
|
||||||
|
|
||||||
out_stream = es_fdopen_nc (out_fd, "w");
|
out_stream = open_stream_nc (out_fd, "w");
|
||||||
if (!out_stream)
|
if (!out_stream)
|
||||||
{
|
{
|
||||||
es_fclose (in_stream);
|
es_fclose (in_stream);
|
||||||
@ -1138,7 +1138,7 @@ static gpg_error_t
|
|||||||
cmd_getauditlog (assuan_context_t ctx, char *line)
|
cmd_getauditlog (assuan_context_t ctx, char *line)
|
||||||
{
|
{
|
||||||
ctrl_t ctrl = assuan_get_pointer (ctx);
|
ctrl_t ctrl = assuan_get_pointer (ctx);
|
||||||
int out_fd;
|
gnupg_fd_t out_fd;
|
||||||
estream_t out_stream;
|
estream_t out_stream;
|
||||||
int opt_data, opt_html;
|
int opt_data, opt_html;
|
||||||
int rc;
|
int rc;
|
||||||
@ -1159,11 +1159,11 @@ cmd_getauditlog (assuan_context_t ctx, char *line)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
out_fd = translate_sys2libc_fd (assuan_get_output_fd (ctx), 1);
|
out_fd = assuan_get_output_fd (ctx);
|
||||||
if (out_fd == -1)
|
if (out_fd == GNUPG_INVALID_FD)
|
||||||
return set_error (GPG_ERR_ASS_NO_OUTPUT, NULL);
|
return set_error (GPG_ERR_ASS_NO_OUTPUT, NULL);
|
||||||
|
|
||||||
out_stream = es_fdopen_nc (out_fd, "w");
|
out_stream = open_stream_nc (out_fd, "w");
|
||||||
if (!out_stream)
|
if (!out_stream)
|
||||||
{
|
{
|
||||||
return set_error (GPG_ERR_ASS_GENERAL, "es_fdopen() failed");
|
return set_error (GPG_ERR_ASS_GENERAL, "es_fdopen() failed");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user