diff options
author | Thomas Roessler <roessler@does-not-exist.org> | 1998-10-07 19:58:18 +0000 |
---|---|---|
committer | Thomas Roessler <roessler@does-not-exist.org> | 1998-10-07 19:58:18 +0000 |
commit | 0205d11c70aef1795f01025360baab5542495bde (patch) | |
tree | e7c3fea2c26d412485cb9115de04226c8f5f1e12 | |
parent | 3e6a7a62b87b94d51b492894e54175a64b1088ec (diff) |
Redirect stdin and stderr to /dev/null when invoking gpgm for
listing key IDs.
-rw-r--r-- | gnupgparse.c | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/gnupgparse.c b/gnupgparse.c index a82093ed..131db8b9 100644 --- a/gnupgparse.c +++ b/gnupgparse.c @@ -20,7 +20,11 @@ #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; } |