Skip to content

Commit

Permalink
Initialize "acc" value inside the loop to reset failed attempts.
Browse files Browse the repository at this point in the history
PR:		misc/162262
MFC after:	3 days
  • Loading branch information
bu7cher committed Nov 6, 2011
1 parent 744cbe3 commit 78dbeda
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions sbin/fdisk/fdisk.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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);
}

}


Expand Down

0 comments on commit 78dbeda

Please sign in to comment.