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
This commit is contained in:
Dag-Erling Smørgrav 2014-12-15 17:11:36 +00:00
parent 1cffa76b4f
commit 00fb76245a
1 changed files with 3 additions and 3 deletions

View File

@ -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;