Index: trunk/src/sh_gpg.c
===================================================================
--- trunk/src/sh_gpg.c	(revision 197)
+++ trunk/src/sh_gpg.c	(revision 198)
@@ -241,4 +241,5 @@
 			    int mode, char * id, char * homedir)
 {
+  extern int flag_err_debug;
   int pipedes[2];
   FILE * outf = NULL;
@@ -489,9 +490,13 @@
       sh_unix_closeall (3, -1, SL_TRUE); /* in child process */
 
-      if (NULL == freopen(_("/dev/null"), "r+", stderr))
-	{
-	  dlog(1, FIL__, __LINE__, _("Internal error: freopen failed\n"));
-	  aud__exit(FIL__, __LINE__, EXIT_FAILURE);
-	}
+      if (flag_err_debug != SL_TRUE)
+	{
+	  if (NULL == freopen(_("/dev/null"), "r+", stderr))
+	    {
+	      dlog(1, FIL__, __LINE__, _("Internal error: freopen failed\n"));
+	      aud__exit(FIL__, __LINE__, EXIT_FAILURE);
+	    }
+	}
+
 
       /* We should become privileged if SUID,
