From 00fb76245a747b66ba02e05d73c802ae8fe031d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dag-Erling=20Sm=C3=B8rgrav?= Date: Mon, 15 Dec 2014 17:11:36 +0000 Subject: [PATCH] Silence an uninitialized variable warning from gcc, which does not realize that the resynchronization loop will always run at least once. Adjust the loop condition, which unintentionally ignored errors. Remove a debugging message. git-svn-id: svn+ssh://svn.openpam.org/svn/openpam/trunk@851 185d5e19-27fe-0310-9dcf-9bff6b9f3609 --- bin/oathkey/oathkey.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bin/oathkey/oathkey.c b/bin/oathkey/oathkey.c index 34948a6..4dcc38b 100644 --- a/bin/oathkey/oathkey.c +++ b/bin/oathkey/oathkey.c @@ -354,17 +354,17 @@ oathkey_resync(int argc, char *argv[]) case om_hotp: /* this should be a library function */ counter = key->counter; - while (key->counter < counter + w) { + match = 0; + while (key->counter < counter + w && match == 0) { match = oath_hotp_match(key, response[0], counter + w - key->counter - 1); - warnx("%d", match); if (match <= 0) break; for (i = 1; i < n && match > 0; ++i) match = oath_hotp_match(key, response[i], 0); } if (verbose && match > 0) - warnx("skipped %lu codes", key->counter - counter - 1); + warnx("skipped %lu codes", key->counter - counter); break; default: match = -1;