diff options
author | NIIBE Yutaka <[email protected]> | 2023-07-13 04:44:32 +0000 |
---|---|---|
committer | NIIBE Yutaka <[email protected]> | 2023-07-13 04:44:32 +0000 |
commit | d32c23b369c9e01abefb0ea17d9ee4d9589c4d99 (patch) | |
tree | 1a0847071ec268aaec3c61d63975c691cccd8f44 | |
parent | sm: Fix the cases where input from stdin. (diff) | |
download | gnupg-d32c23b369c9e01abefb0ea17d9ee4d9589c4d99.tar.gz gnupg-d32c23b369c9e01abefb0ea17d9ee4d9589c4d99.zip |
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 <[email protected]>
-rw-r--r-- | sm/server.c | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/sm/server.c b/sm/server.c index a8b12c057..4a2490d53 100644 --- a/sm/server.c +++ b/sm/server.c @@ -1119,24 +1119,24 @@ static gpg_error_t cmd_genkey (assuan_context_t ctx, char *line) { 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; int rc; (void)line; - inp_fd = translate_sys2libc_fd (assuan_get_input_fd (ctx), 0); - if (inp_fd == -1) + inp_fd = assuan_get_input_fd (ctx); + if (inp_fd == GNUPG_INVALID_FD) return set_error (GPG_ERR_ASS_NO_INPUT, NULL); - out_fd = translate_sys2libc_fd (assuan_get_output_fd (ctx), 1); - if (out_fd == -1) + out_fd = assuan_get_output_fd (ctx); + if (out_fd == GNUPG_INVALID_FD) 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) 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) { es_fclose (in_stream); @@ -1167,7 +1167,7 @@ static gpg_error_t cmd_getauditlog (assuan_context_t ctx, char *line) { ctrl_t ctrl = assuan_get_pointer (ctx); - int out_fd; + gnupg_fd_t out_fd; estream_t out_stream; int opt_data, opt_html; int rc; @@ -1188,11 +1188,11 @@ cmd_getauditlog (assuan_context_t ctx, char *line) } else { - out_fd = translate_sys2libc_fd (assuan_get_output_fd (ctx), 1); - if (out_fd == -1) + out_fd = assuan_get_output_fd (ctx); + if (out_fd == GNUPG_INVALID_FD) 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) { return set_error (GPG_ERR_ASS_GENERAL, "es_fdopen() failed"); |