diff --git a/common/ChangeLog b/common/ChangeLog index d63b3657e..f956cc0fd 100644 --- a/common/ChangeLog +++ b/common/ChangeLog @@ -1,3 +1,9 @@ +2010-03-08 Werner Koch + + * exechelp.h: Include "estream.h". + + * exechelp.c (gnupg_spawn_process): Change OUTFILE to an estream_t. + 2010-03-02 Werner Koch * estream.c, estream.h, estream-printf.c, estream-printf.h: Update diff --git a/common/exechelp.c b/common/exechelp.c index 4a385bcd7..95e5b633c 100644 --- a/common/exechelp.c +++ b/common/exechelp.c @@ -1,5 +1,6 @@ /* exechelp.c - fork and exec helpers - * Copyright (C) 2004, 2007, 2008, 2009 Free Software Foundation, Inc. + * Copyright (C) 2004, 2007, 2008, 2009, + * 2010 Free Software Foundation, Inc. * * This file is part of GnuPG. * @@ -174,7 +175,7 @@ close_all_fds (int first, int *except) close (fd); } - errno = 0; + gpg_err_set_errno (0); } @@ -555,7 +556,7 @@ gnupg_create_outbound_pipe (int filedes[2]) Returns 0 on success or an error code. */ gpg_error_t gnupg_spawn_process (const char *pgmname, const char *argv[], - FILE *infile, FILE *outfile, + FILE *infile, estream_t outfile, void (*preexec)(void), unsigned int flags, FILE **statusfile, pid_t *pid) { @@ -582,7 +583,7 @@ gnupg_spawn_process (const char *pgmname, const char *argv[], fflush (infile); rewind (infile); fd = _get_osfhandle (fileno (infile)); - fdout = _get_osfhandle (fileno (outfile)); + fdout = _get_osfhandle (es_fileno (outfile)); if (fd == -1 || fdout == -1) log_fatal ("no file descriptor for file passed to gnupg_spawn_process\n"); @@ -690,7 +691,7 @@ gnupg_spawn_process (const char *pgmname, const char *argv[], fflush (infile); rewind (infile); fd = fileno (infile); - fdout = fileno (outfile); + fdout = es_fileno (outfile); if (fd == -1 || fdout == -1) log_fatal ("no file descriptor for file passed to gnupg_spawn_process\n"); diff --git a/common/exechelp.h b/common/exechelp.h index 8f056891c..06cb79c29 100644 --- a/common/exechelp.h +++ b/common/exechelp.h @@ -20,6 +20,9 @@ #ifndef GNUPG_COMMON_EXECHELP_H #define GNUPG_COMMON_EXECHELP_H +#include "estream.h" + + /* Return the maximum number of currently allowed file descriptors. Only useful on POSIX systems. */ int get_max_fds (void); @@ -59,7 +62,7 @@ gpg_error_t gnupg_create_outbound_pipe (int filedes[2]); details. Calling gnupg_wait_process is required. Returns 0 on success or an error code. */ gpg_error_t gnupg_spawn_process (const char *pgmname, const char *argv[], - FILE *infile, FILE *outfile, + FILE *infile, estream_t outfile, void (*preexec)(void), unsigned int flags, FILE **statusfile, pid_t *pid);