common: New helper function gnupg_close_pipe.

* common/exechelp-posix.c (gnupg_close_pipe): New.
* common/exechelp-w32.c (gnupg_close_pipe): New.
--

This function is mainly for documentation purposes and should be used
along with gnupg_create_pipe.

Signed-off-by: Werner Koch <wk@gnupg.org>
This commit is contained in:
Werner Koch 2020-09-02 14:49:24 +02:00
parent 2cd8bae23d
commit 2042f5a464
No known key found for this signature in database
GPG Key ID: E3FDFF218E45B72B
3 changed files with 21 additions and 0 deletions

View File

@ -416,6 +416,15 @@ gnupg_create_pipe (int filedes[2])
}
/* Close the end of a pipe. */
void
gnupg_close_pipe (int fd)
{
if (fd != -1)
close (fd);
}
/* Fork and exec the PGMNAME, see exechelp.h for details. */
gpg_error_t
gnupg_spawn_process (const char *pgmname, const char *argv[],

View File

@ -397,6 +397,15 @@ gnupg_create_pipe (int filedes[2])
}
/* Close the end of a pipe. */
void
gnupg_close_pipe (int fd)
{
if (fd != -1)
close (fd);
}
/* Fork and exec the PGMNAME, see exechelp.h for details. */
gpg_error_t
gnupg_spawn_process (const char *pgmname, const char *argv[],

View File

@ -69,6 +69,9 @@ gpg_error_t gnupg_create_outbound_pipe (int filedes[2],
inheritable. */
gpg_error_t gnupg_create_pipe (int filedes[2]);
/* Close the end of a pipe. */
void gnupg_close_pipe (int fd);
#define GNUPG_SPAWN_NONBLOCK 16
#define GNUPG_SPAWN_RUN_ASFW 64