Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/crypto/external/bsd/netpgp/dist/src/netpgpverify Fix the err...
details: https://anonhg.NetBSD.org/src/rev/70aed77858a4
branches: trunk
changeset: 347565:70aed77858a4
user: christos <christos%NetBSD.org@localhost>
date: Sat Sep 03 09:31:22 2016 +0000
description:
Fix the error handling so that we print the earliest error message.
diffstat:
crypto/external/bsd/netpgp/dist/src/netpgpverify/libverify.c | 13 ++++++-----
1 files changed, 7 insertions(+), 6 deletions(-)
diffs (47 lines):
diff -r 01ec1c4b39f0 -r 70aed77858a4 crypto/external/bsd/netpgp/dist/src/netpgpverify/libverify.c
--- a/crypto/external/bsd/netpgp/dist/src/netpgpverify/libverify.c Sat Sep 03 09:08:28 2016 +0000
+++ b/crypto/external/bsd/netpgp/dist/src/netpgpverify/libverify.c Sat Sep 03 09:31:22 2016 +0000
@@ -2085,8 +2085,10 @@
{
FILE *fp;
char buf[BUFSIZ];
+ int rv;
if (cursor == NULL || pgp == NULL || p == NULL) {
+ snprintf(cursor->why, sizeof(cursor->why), "No input data");
return 0;
}
memset(cursor, 0x0, sizeof(*cursor));
@@ -2104,19 +2106,19 @@
return 0;
}
if (is_armored(buf, sizeof(buf))) {
- read_ascii_armor_file(cursor, p);
+ rv = read_ascii_armor_file(cursor, p);
} else {
- read_binary_file(pgp, "signature", "%s", (const char *)p);
+ rv = read_binary_file(pgp, "signature", "%s", (const char *)p);
}
fclose(fp);
} else {
if (is_armored(p, (size_t)size)) {
- read_ascii_armor_memory(cursor, p, (size_t)size);
+ rv = read_ascii_armor_memory(cursor, p, (size_t)size);
} else {
- read_binary_memory(pgp, "signature", p, (size_t)size);
+ rv = read_binary_memory(pgp, "signature", p, (size_t)size);
}
}
- return 1;
+ return rv;
}
/* get the data and size from litdata packet */
@@ -2780,7 +2782,6 @@
return 0;
}
if (!setup_data(cursor, pgp, p, size)) {
- snprintf(cursor->why, sizeof(cursor->why), "No input data");
return 0;
}
if (ARRAY_COUNT(cursor->pgp->pkts) == ARRAY_LAST(cursor->pgp->datastarts) + 1) {
Home |
Main Index |
Thread Index |
Old Index