1
0
Fork 0
mirror of git://git.gnupg.org/gnupg.git synced 2025-07-02 22:46:30 +02:00

Extended the --check-program output: Error messages are now inlcued in an

easy parsable format.
This commit is contained in:
Werner Koch 2007-08-29 16:59:20 +00:00
parent b13587ef16
commit 8464627bf4
37 changed files with 3802 additions and 1834 deletions

View file

@ -270,6 +270,50 @@ do_exec (const char *pgmname, const char *argv[],
#endif /*!HAVE_W32_SYSTEM*/
/* Portable function to create a pipe. Under Windows the write end is
inheritable. */
gpg_error_t
gnupg_create_inbound_pipe (int filedes[2])
{
gpg_error_t err = 0;
#if HAVE_W32_SYSTEM
int fds[2];
filedes[0] = filedes[1] = -1;
err = gpg_error (GPG_ERR_GENERAL);
if (!create_inheritable_pipe (fds))
{
filedes[0] = _open_osfhandle (fds[0], 0);
if (filedes[0] == -1)
{
log_error ("failed to translate osfhandle %p\n", (void*)fds[0]);
CloseHandle (fd_to_handle (fds[1]));
}
else
{
filedes[1] = _open_osfhandle (fds[1], 1);
if (filedes[1] == -1)
{
log_error ("failed to translate osfhandle %p\n", (void*)fds[1]);
close (filedes[0]);
filedes[0] = -1;
CloseHandle (fd_to_handle (fds[1]));
}
else
err = 0;
}
}
#else
if (pipe (filedes) == -1)
{
err = gpg_error_from_syserror ();
filedes[0] = filedes[1] = -1;
}
#endif
return err;
}
/* Fork and exec the PGMNAME, connect the file descriptor of INFILE to
stdin, write the output to OUTFILE, return a new stream in
STATUSFILE for stderr and the pid of the process in PID. The