summaryrefslogtreecommitdiffstats
path: root/g10/verify.c
diff options
context:
space:
mode:
authorWerner Koch <wk@gnupg.org>2003-06-18 21:56:13 +0200
committerWerner Koch <wk@gnupg.org>2003-06-18 21:56:13 +0200
commitc0c2c58054923d506f61ce9a71d509b48a381211 (patch)
treea8f82bffb44eb68eb726ff6db41fa715bcd29193 /g10/verify.c
parentA small step for GnuPG but a huge leap for error codes. (diff)
downloadgnupg2-c0c2c58054923d506f61ce9a71d509b48a381211.tar.xz
gnupg2-c0c2c58054923d506f61ce9a71d509b48a381211.zip
Finished the bulk of changes for gnupg 1.9. This included switching
to libgcrypt functions, using shared error codes from libgpg-error, replacing the old functions we used to have in ../util by those in ../jnlib and ../common, renaming the malloc functions and a couple of types. Note, that not all changes are listed below becuause they are too similar and done at far too many places. As of today the code builds using the current libgcrypt from CVS but it is very unlikely that it actually works.
Diffstat (limited to 'g10/verify.c')
-rw-r--r--g10/verify.c22
1 files changed, 13 insertions, 9 deletions
diff --git a/g10/verify.c b/g10/verify.c
index 705a45746..cfa373637 100644
--- a/g10/verify.c
+++ b/g10/verify.c
@@ -54,7 +54,7 @@
int
verify_signatures( int nfiles, char **files )
{
- IOBUF fp;
+ iobuf_t fp;
armor_filter_context_t afx;
progress_filter_context_t pfx;
const char *sigfile;
@@ -92,8 +92,10 @@ verify_signatures( int nfiles, char **files )
/* open the signature file */
fp = iobuf_open(sigfile);
if( !fp ) {
- log_error(_("can't open `%s'\n"), print_fname_stdin(sigfile));
- return G10ERR_OPEN_FILE;
+ rc = gpg_error_from_errno (errno);
+ log_error(_("can't open `%s': %s\n"),
+ print_fname_stdin(sigfile), strerror (errno));
+ return rc;
}
handle_progress (&pfx, fp, sigfile);
@@ -120,17 +122,17 @@ verify_signatures( int nfiles, char **files )
void
print_file_status( int status, const char *name, int what )
{
- char *p = m_alloc(strlen(name)+10);
+ char *p = xmalloc (strlen(name)+10);
sprintf(p, "%d %s", what, name );
write_status_text( status, p );
- m_free(p);
+ xfree (p);
}
static int
verify_one_file( const char *name )
{
- IOBUF fp;
+ iobuf_t fp;
armor_filter_context_t afx;
progress_filter_context_t pfx;
int rc;
@@ -138,9 +140,11 @@ verify_one_file( const char *name )
print_file_status( STATUS_FILE_START, name, 1 );
fp = iobuf_open(name);
if( !fp ) {
+ rc = gpg_error_from_errno (errno);
+ log_error(_("can't open `%s': %s\n"),
+ print_fname_stdin(name), strerror (errno));
print_file_status( STATUS_FILE_ERROR, name, 1 );
- log_error(_("can't open `%s'\n"), print_fname_stdin(name));
- return G10ERR_OPEN_FILE;
+ return rc;
}
handle_progress (&pfx, fp, name);
@@ -175,7 +179,7 @@ verify_files( int nfiles, char **files )
lno++;
if( !*line || line[strlen(line)-1] != '\n' ) {
log_error(_("input line %u too long or missing LF\n"), lno );
- return G10ERR_GENERAL;
+ return GPG_ERR_GENERAL;
}
/* This code does not work on MSDOS but how cares there are
* also no script languages available. We don't strip any