aboutsummaryrefslogtreecommitdiffstats
path: root/agent/gpg-agent.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--agent/gpg-agent.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/agent/gpg-agent.c b/agent/gpg-agent.c
index 5201be8d5..979fa3564 100644
--- a/agent/gpg-agent.c
+++ b/agent/gpg-agent.c
@@ -1007,7 +1007,16 @@ main (int argc, char **argv )
for (i=0; i <= 2; i++)
{
if (!log_test_fd (i) && i != fd )
- close (i);
+ {
+ if ( ! close (i)
+ && open ("/dev/null", i? O_WRONLY : O_RDONLY) == -1)
+ {
+ log_error ("failed to open `%s': %s\n",
+ "/dev/null", strerror (errno));
+ cleanup ();
+ exit (1);
+ }
+ }
}
if (setsid() == -1)
{