summaryrefslogtreecommitdiffstats
path: root/g10/verify.c
diff options
context:
space:
mode:
authorWerner Koch <wk@gnupg.org>2010-03-08 19:19:21 +0100
committerWerner Koch <wk@gnupg.org>2010-03-08 19:19:21 +0100
commit6216d33e8cc1c2d01533b3e9b97dc7009b4f3553 (patch)
tree062bf701637025088b83a9e8684aa7a1eae68fb5 /g10/verify.c
parentUse macros for iobuf ioctls. (diff)
downloadgnupg2-6216d33e8cc1c2d01533b3e9b97dc7009b4f3553.tar.xz
gnupg2-6216d33e8cc1c2d01533b3e9b97dc7009b4f3553.zip
Removed almost al dup calls.
Diffstat (limited to 'g10/verify.c')
-rw-r--r--g10/verify.c19
1 files changed, 9 insertions, 10 deletions
diff --git a/g10/verify.c b/g10/verify.c
index 9ca5591bc..253a5920b 100644
--- a/g10/verify.c
+++ b/g10/verify.c
@@ -1,6 +1,6 @@
/* verify.c - Verify signed data
* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2004, 2005, 2006,
- * 2007 Free Software Foundation, Inc.
+ * 2007, 2010 Free Software Foundation, Inc.
*
* This file is part of GnuPG.
*
@@ -39,7 +39,6 @@
#include "i18n.h"
-
/****************
* Assume that the input is a signature and verify it without
* generating any output. With no arguments, the signature packet
@@ -231,7 +230,7 @@ verify_files( int nfiles, char **files )
FIXME: OUTFP is not yet implemented.
*/
int
-gpg_verify (ctrl_t ctrl, int sig_fd, int data_fd, FILE *out_fp)
+gpg_verify (ctrl_t ctrl, int sig_fd, int data_fd, estream_t out_fp)
{
int rc;
iobuf_t fp;
@@ -241,13 +240,14 @@ gpg_verify (ctrl_t ctrl, int sig_fd, int data_fd, FILE *out_fp)
(void)ctrl;
(void)out_fp;
- fp = iobuf_fdopen (sig_fd, "rb");
- if (fp && is_secured_file (sig_fd))
+ if (is_secured_file (sig_fd))
{
fp = NULL;
- errno = EPERM;
+ gpg_err_set_errno (EPERM);
}
- if ( !fp )
+ else
+ fp = iobuf_fdopen_nc (sig_fd, "rb");
+ if (!fp)
{
rc = gpg_error_from_syserror ();
log_error (_("can't open fd %d: %s\n"), sig_fd, strerror (errno));
@@ -262,15 +262,14 @@ gpg_verify (ctrl_t ctrl, int sig_fd, int data_fd, FILE *out_fp)
push_armor_filter (afx, fp);
}
- rc = proc_signature_packets_by_fd ( NULL, fp, data_fd );
+ rc = proc_signature_packets_by_fd (NULL, fp, data_fd);
if ( afx && afx->no_openpgp_data
&& (rc == -1 || gpg_err_code (rc) == GPG_ERR_EOF) )
rc = gpg_error (GPG_ERR_NO_DATA);
leave:
- if (fp)
- iobuf_close (fp);
+ iobuf_close (fp);
release_progress_context (pfx);
release_armor_context (afx);
return rc;