Initialize "acc" value inside the loop to reset failed attempts.

PR:		misc/162262
MFC after:	3 days
This commit is contained in:
Andrey V. Elsukov 2011-11-06 21:12:52 +00:00
parent 212b1d6d4f
commit 1b100fd31b

View File

@ -922,11 +922,12 @@ ok(const char *str)
static int
decimal(const char *str, int *num, int deflt, uint32_t maxval)
{
long long acc = 0;
long long acc;
int c;
char *cp;
while (1) {
acc = 0;
printf("Supply a decimal value for \"%s\" [%d] ", str, deflt);
fflush(stdout);
if (fgets(lbuf, LBUF, stdin) == NULL)
@ -962,7 +963,6 @@ decimal(const char *str, int *num, int deflt, uint32_t maxval)
printf("%s is an invalid decimal number. Try again.\n",
lbuf);
}
}