summaryrefslogtreecommitdiffstats
path: root/common/exechelp-posix.c
diff options
context:
space:
mode:
authorWerner Koch <wk@gnupg.org>2010-06-07 15:33:02 +0200
committerWerner Koch <wk@gnupg.org>2010-06-07 15:33:02 +0200
commitbbe388b5db35be6ffece8ebd42f11372af016763 (patch)
tree73e1fe9697b969be66bd89953125010e5721efe1 /common/exechelp-posix.c
parentPrint --version etc via estream (diff)
downloadgnupg2-bbe388b5db35be6ffece8ebd42f11372af016763.tar.xz
gnupg2-bbe388b5db35be6ffece8ebd42f11372af016763.zip
Add unfinished gpgtar.
Collected changes and ports of bug fixes from stable.
Diffstat (limited to 'common/exechelp-posix.c')
-rw-r--r--common/exechelp-posix.c21
1 files changed, 16 insertions, 5 deletions
diff --git a/common/exechelp-posix.c b/common/exechelp-posix.c
index aaf628715..1f4cca6c8 100644
--- a/common/exechelp-posix.c
+++ b/common/exechelp-posix.c
@@ -313,11 +313,22 @@ gnupg_spawn_process (const char *pgmname, const char *argv[],
*statusfile = NULL;
*pid = (pid_t)(-1);
- es_fflush (infile);
- es_rewind (infile);
- fd = es_fileno (infile);
- fdout = es_fileno (outfile);
- if (fd == -1 || fdout == -1)
+
+ if (infile)
+ {
+ es_fflush (infile);
+ es_rewind (infile);
+ fd = es_fileno (infile);
+ }
+ else
+ fd = -1;
+
+ if (outfile)
+ fdout = es_fileno (outfile);
+ else
+ fdout = -1;
+
+ if ((infile && fd == -1) || (outfile && fdout == -1))
log_fatal ("no file descriptor for file passed to gnupg_spawn_process\n");
if (pipe (rp) == -1)