mirror of
git://git.gnupg.org/gnupg.git
synced 2025-07-02 22:46:30 +02:00
common: Extend gnupg_create_inbound_pipe et al.
* common/exechelp-posix.c (gnupg_create_inbound_pipe): Add args 'r_fp' and 'nonblock'. (gnupg_create_outbound_pipe): Ditto. * common/exechelp-w32.c (gnupg_create_inbound_pipe): Add non yet functional args 'r_fp' and 'nonblock'. (gnupg_create_outbound_pipe): Ditto. * common/exechelp-w32ce.c (gnupg_create_inbound_pipe): Ditto. (gnupg_create_outbound_pipe): Ditto. -- Signed-off-by: Werner Koch <wk@gnupg.org>
This commit is contained in:
parent
96c7901ec1
commit
5d991e333a
7 changed files with 54 additions and 28 deletions
|
@ -430,9 +430,9 @@ _gpg_encrypt (ctrl_t ctrl,
|
||||||
assert ((reader_mb == NULL) != (cipher_stream == NULL));
|
assert ((reader_mb == NULL) != (cipher_stream == NULL));
|
||||||
|
|
||||||
/* Create two pipes. */
|
/* Create two pipes. */
|
||||||
err = gnupg_create_outbound_pipe (outbound_fds);
|
err = gnupg_create_outbound_pipe (outbound_fds, NULL, 0);
|
||||||
if (!err)
|
if (!err)
|
||||||
err = gnupg_create_inbound_pipe (inbound_fds);
|
err = gnupg_create_inbound_pipe (inbound_fds, NULL, 0);
|
||||||
if (err)
|
if (err)
|
||||||
{
|
{
|
||||||
log_error (_("error creating a pipe: %s\n"), gpg_strerror (err));
|
log_error (_("error creating a pipe: %s\n"), gpg_strerror (err));
|
||||||
|
@ -614,9 +614,9 @@ _gpg_decrypt (ctrl_t ctrl,
|
||||||
assert ((reader_mb == NULL) != (plain_stream == NULL));
|
assert ((reader_mb == NULL) != (plain_stream == NULL));
|
||||||
|
|
||||||
/* Create two pipes. */
|
/* Create two pipes. */
|
||||||
err = gnupg_create_outbound_pipe (outbound_fds);
|
err = gnupg_create_outbound_pipe (outbound_fds, NULL, 0);
|
||||||
if (!err)
|
if (!err)
|
||||||
err = gnupg_create_inbound_pipe (inbound_fds);
|
err = gnupg_create_inbound_pipe (inbound_fds, NULL, 0);
|
||||||
if (err)
|
if (err)
|
||||||
{
|
{
|
||||||
log_error (_("error creating a pipe: %s\n"), gpg_strerror (err));
|
log_error (_("error creating a pipe: %s\n"), gpg_strerror (err));
|
||||||
|
|
|
@ -341,19 +341,27 @@ create_pipe_and_estream (int filedes[2], estream_t *r_fp,
|
||||||
|
|
||||||
|
|
||||||
/* Portable function to create a pipe. Under Windows the write end is
|
/* Portable function to create a pipe. Under Windows the write end is
|
||||||
inheritable. */
|
inheritable. If R_FP is not NULL, an estream is created for the
|
||||||
|
read end and stored at R_FP. */
|
||||||
gpg_error_t
|
gpg_error_t
|
||||||
gnupg_create_inbound_pipe (int filedes[2])
|
gnupg_create_inbound_pipe (int filedes[2], estream_t *r_fp, int nonblock)
|
||||||
{
|
{
|
||||||
|
if (r_fp)
|
||||||
|
return create_pipe_and_estream (filedes, r_fp, 0, nonblock);
|
||||||
|
else
|
||||||
return do_create_pipe (filedes);
|
return do_create_pipe (filedes);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Portable function to create a pipe. Under Windows the read end is
|
/* Portable function to create a pipe. Under Windows the read end is
|
||||||
inheritable. */
|
inheritable. If R_FP is not NULL, an estream is created for the
|
||||||
|
write end and stored at R_FP. */
|
||||||
gpg_error_t
|
gpg_error_t
|
||||||
gnupg_create_outbound_pipe (int filedes[2])
|
gnupg_create_outbound_pipe (int filedes[2], estream_t *r_fp, int nonblock)
|
||||||
{
|
{
|
||||||
|
if (r_fp)
|
||||||
|
return create_pipe_and_estream (filedes, r_fp, 1, nonblock);
|
||||||
|
else
|
||||||
return do_create_pipe (filedes);
|
return do_create_pipe (filedes);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -320,19 +320,27 @@ do_create_pipe (int filedes[2], int flags)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Portable function to create a pipe. Under Windows the write end is
|
/* Portable function to create a pipe. Under Windows the write end is
|
||||||
inheritable. */
|
inheritable. If R_FP is not NULL, an estream is created for the
|
||||||
|
read end and stored at R_FP. */
|
||||||
gpg_error_t
|
gpg_error_t
|
||||||
gnupg_create_inbound_pipe (int filedes[2])
|
gnupg_create_inbound_pipe (int filedes[2], estream_t *r_fp, int nonblock)
|
||||||
{
|
{
|
||||||
|
if (r_fp)
|
||||||
|
return gpg_error (GPG_ERR_NOT_IMPLEMENTED);
|
||||||
|
else
|
||||||
return do_create_pipe (filedes, INHERIT_WRITE);
|
return do_create_pipe (filedes, INHERIT_WRITE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Portable function to create a pipe. Under Windows the read end is
|
/* Portable function to create a pipe. Under Windows the read end is
|
||||||
inheritable. */
|
inheritable. If R_FP is not NULL, an estream is created for the
|
||||||
|
write end and stored at R_FP. */
|
||||||
gpg_error_t
|
gpg_error_t
|
||||||
gnupg_create_outbound_pipe (int filedes[2])
|
gnupg_create_outbound_pipe (int filedes[2], estream_t *r_fp, int nonblock)
|
||||||
{
|
{
|
||||||
|
if (r_fp)
|
||||||
|
return gpg_error (GPG_ERR_NOT_IMPLEMENTED);
|
||||||
|
else
|
||||||
return do_create_pipe (filedes, INHERIT_READ);
|
return do_create_pipe (filedes, INHERIT_READ);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -450,8 +450,11 @@ create_inheritable_pipe (int filedes[2], int inherit_idx)
|
||||||
/* Portable function to create a pipe. Under Windows the write end is
|
/* Portable function to create a pipe. Under Windows the write end is
|
||||||
inheritable (i.e. an rendezvous id). */
|
inheritable (i.e. an rendezvous id). */
|
||||||
gpg_error_t
|
gpg_error_t
|
||||||
gnupg_create_inbound_pipe (int filedes[2])
|
gnupg_create_inbound_pipe (int filedes[2], estream_t *r_fp, int nonblock)
|
||||||
{
|
{
|
||||||
|
if (r_fp)
|
||||||
|
return gpg_error (GPG_ERR_NOT_IMPLEMENTED);
|
||||||
|
else
|
||||||
return create_inheritable_pipe (filedes, 1);
|
return create_inheritable_pipe (filedes, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -459,8 +462,11 @@ gnupg_create_inbound_pipe (int filedes[2])
|
||||||
/* Portable function to create a pipe. Under Windows the read end is
|
/* Portable function to create a pipe. Under Windows the read end is
|
||||||
inheritable (i.e. an rendezvous id). */
|
inheritable (i.e. an rendezvous id). */
|
||||||
gpg_error_t
|
gpg_error_t
|
||||||
gnupg_create_outbound_pipe (int filedes[2])
|
gnupg_create_outbound_pipe (int filedes[2], estream_t *r_fp, int nonblock)
|
||||||
{
|
{
|
||||||
|
if (r_fp)
|
||||||
|
return gpg_error (GPG_ERR_NOT_IMPLEMENTED);
|
||||||
|
else
|
||||||
return create_inheritable_pipe (filedes, 0);
|
return create_inheritable_pipe (filedes, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -52,12 +52,16 @@ int *get_all_open_fds (void);
|
||||||
|
|
||||||
|
|
||||||
/* Portable function to create a pipe. Under Windows the write end is
|
/* Portable function to create a pipe. Under Windows the write end is
|
||||||
inheritable. */
|
inheritable. If R_FP is not NULL, an estream is created for the
|
||||||
gpg_error_t gnupg_create_inbound_pipe (int filedes[2]);
|
write end and stored at R_FP. */
|
||||||
|
gpg_error_t gnupg_create_inbound_pipe (int filedes[2],
|
||||||
|
estream_t *r_fp, int nonblock);
|
||||||
|
|
||||||
/* Portable function to create a pipe. Under Windows the read end is
|
/* Portable function to create a pipe. Under Windows the read end is
|
||||||
inheritable. */
|
inheritable. If R_FP is not NULL, an estream is created for the
|
||||||
gpg_error_t gnupg_create_outbound_pipe (int filedes[2]);
|
write end and stored at R_FP. */
|
||||||
|
gpg_error_t gnupg_create_outbound_pipe (int filedes[2],
|
||||||
|
estream_t *r_fp, int nonblock);
|
||||||
|
|
||||||
/* Portable function to create a pipe. Under Windows both ends are
|
/* Portable function to create a pipe. Under Windows both ends are
|
||||||
inheritable. */
|
inheritable. */
|
||||||
|
|
|
@ -695,10 +695,10 @@ ldap_wrapper (ctrl_t ctrl, ksba_reader_t *reader, const char *argv[])
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
err = gnupg_create_inbound_pipe (outpipe);
|
err = gnupg_create_inbound_pipe (outpipe, NULL, 0);
|
||||||
if (!err)
|
if (!err)
|
||||||
{
|
{
|
||||||
err = gnupg_create_inbound_pipe (errpipe);
|
err = gnupg_create_inbound_pipe (errpipe, NULL, 0);
|
||||||
if (err)
|
if (err)
|
||||||
{
|
{
|
||||||
close (outpipe[0]);
|
close (outpipe[0]);
|
||||||
|
|
|
@ -246,9 +246,9 @@ run_encfs_tool (ctrl_t ctrl, enum encfs_cmds cmd,
|
||||||
if (err)
|
if (err)
|
||||||
goto leave;
|
goto leave;
|
||||||
|
|
||||||
err = gnupg_create_inbound_pipe (inbound);
|
err = gnupg_create_inbound_pipe (inbound, NULL, 0);
|
||||||
if (!err)
|
if (!err)
|
||||||
err = gnupg_create_outbound_pipe (outbound);
|
err = gnupg_create_outbound_pipe (outbound, NULL, 0);
|
||||||
if (err)
|
if (err)
|
||||||
{
|
{
|
||||||
log_error (_("error creating a pipe: %s\n"), gpg_strerror (err));
|
log_error (_("error creating a pipe: %s\n"), gpg_strerror (err));
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue