summaryrefslogtreecommitdiffstats
path: root/common/exechelp.c
diff options
context:
space:
mode:
authorWerner Koch <wk@gnupg.org>2009-03-03 10:02:58 +0100
committerWerner Koch <wk@gnupg.org>2009-03-03 10:02:58 +0100
commitc20b3db108b090b7b34f48a6085a6824fc4db715 (patch)
treecbedc554619505de2750785252791c51a563bce2 /common/exechelp.c
parentAdd missing option strings. (diff)
downloadgnupg2-c20b3db108b090b7b34f48a6085a6824fc4db715.tar.xz
gnupg2-c20b3db108b090b7b34f48a6085a6824fc4db715.zip
Add --reload command to gpgconf.
Fix a problem in exechelp.c Get ready for a release.
Diffstat (limited to 'common/exechelp.c')
-rw-r--r--common/exechelp.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/common/exechelp.c b/common/exechelp.c
index bb9ddd557..4da3c9787 100644
--- a/common/exechelp.c
+++ b/common/exechelp.c
@@ -238,7 +238,7 @@ do_exec (const char *pgmname, const char *argv[],
for (i=0,j=1; argv[i]; i++, j++)
arg_list[j] = (char*)argv[i];
- /* Connect the standard files. */
+ /* Assign /dev/null to unused FDs. */
for (i=0; i <= 2; i++)
{
if (fds[i] == -1 )
@@ -248,7 +248,12 @@ do_exec (const char *pgmname, const char *argv[],
log_fatal ("failed to open `%s': %s\n",
"/dev/null", strerror (errno));
}
- else if (fds[i] != i && dup2 (fds[i], i) == -1)
+ }
+
+ /* Connect the standard files. */
+ for (i=0; i <= 2; i++)
+ {
+ if (fds[i] != i && dup2 (fds[i], i) == -1)
log_fatal ("dup2 std%s failed: %s\n",
i==0?"in":i==1?"out":"err", strerror (errno));
}