1
0
Fork 0
mirror of git://git.gnupg.org/gnupg.git synced 2025-07-03 22:56:33 +02:00

common,gpg,kbx: Factor out open_stream_nc.

* common/sysutils.h (open_stream_nc): New.
* common/sysutils.c (open_stream_nc): New.
* g10/decrypt.c (decrypt_message_fd): Use open_stream_nc.
* g10/server.c (cmd_verify): Likewise.
* kbx/kbxserver.c (prepare_outstream): Likewise.

--

GnuPG-bug-id: 6580
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
This commit is contained in:
NIIBE Yutaka 2023-07-07 15:07:34 +09:00
parent 5bc949d230
commit 37343db08f
No known key found for this signature in database
GPG key ID: 640114AF89DE6054
5 changed files with 23 additions and 29 deletions

View file

@ -114,7 +114,6 @@ decrypt_message_fd (ctrl_t ctrl, gnupg_fd_t input_fd,
IOBUF fp;
armor_filter_context_t *afx = NULL;
progress_filter_context_t *pfx;
es_syshd_t syshd;
if (opt.outfp)
return gpg_error (GPG_ERR_BUG);
@ -140,14 +139,7 @@ decrypt_message_fd (ctrl_t ctrl, gnupg_fd_t input_fd,
return err;
}
#ifdef HAVE_W32_SYSTEM
syshd.type = ES_SYSHD_HANDLE;
syshd.u.handle = output_fd;
#else
syshd.type = ES_SYSHD_FD;
syshd.u.fd = output_fd;
#endif
opt.outfp = es_sysopen_nc (&syshd, "w");
opt.outfp = open_stream_nc (output_fd, "w");
if (!opt.outfp)
{
char xname[64];

View file

@ -388,16 +388,7 @@ cmd_verify (assuan_context_t ctx, char *line)
if (out_fd != GNUPG_INVALID_FD)
{
es_syshd_t syshd;
#ifdef HAVE_W32_SYSTEM
syshd.type = ES_SYSHD_HANDLE;
syshd.u.handle = out_fd;
#else
syshd.type = ES_SYSHD_FD;
syshd.u.fd = out_fd;
#endif
out_fp = es_sysopen_nc (&syshd, "w");
out_fp = open_stream_nc (fd, "w");
if (!out_fp)
return set_error (gpg_err_code_from_syserror (), "fdopen() failed");
}