]> granicus.if.org Git - mutt/commitdiff
Redirect stdin and stderr to /dev/null when invoking gpgm for
authorThomas Roessler <roessler@does-not-exist.org>
Wed, 7 Oct 1998 19:58:18 +0000 (19:58 +0000)
committerThomas Roessler <roessler@does-not-exist.org>
Wed, 7 Oct 1998 19:58:18 +0000 (19:58 +0000)
listing key IDs.

gnupgparse.c

index a82093ed3fff70f1298888a24fe45c6927276fab..131db8b9a298bfe22fa0c828c794a2630c39563b 100644 (file)
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+
+#include <sys/types.h>
+#include <sys/stat.h>
 #include <unistd.h>
+#include <fcntl.h>
 #include <time.h>
 
 #include "mutt.h"
@@ -158,11 +162,18 @@ static KEYINFO *read_ring(struct pgp_vinfo *pgp, int secret )
     char buf[LONG_STRING];
     KEYINFO *db = NULL, **kend, *k = NULL, *kk, *mainkey=NULL;
     int is_sub;
-
-    thepid = gpg_invoke_list_keys(pgp, NULL, &fp, NULL, -1, -1, -1,
+    int devnull;
+  
+    if((devnull = open("/dev/null", O_RDWR)) == -1)
+        return NULL;
+  
+    thepid = gpg_invoke_list_keys(pgp, NULL, &fp, NULL, devnull, -1, devnull,
                                                        NULL, secret);
     if( thepid == -1 )
+    {
+        close(devnull);
        return NULL;
+    }
 
     kend = &db;
     k = NULL;
@@ -187,6 +198,8 @@ static KEYINFO *read_ring(struct pgp_vinfo *pgp, int secret )
     fclose( fp );
     mutt_wait_filter( thepid );
 
+    close(devnull);
+  
     return db;
 }