Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 6 Nov 2011 21:12:52 +0000 (UTC)
From:      "Andrey V. Elsukov" <ae@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r227280 - head/sbin/fdisk
Message-ID:  <201111062112.pA6LCqT7042268@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: ae
Date: Sun Nov  6 21:12:52 2011
New Revision: 227280
URL: http://svn.freebsd.org/changeset/base/227280

Log:
  Initialize "acc" value inside the loop to reset failed attempts.
  
  PR:		misc/162262
  MFC after:	3 days

Modified:
  head/sbin/fdisk/fdisk.c

Modified: head/sbin/fdisk/fdisk.c
==============================================================================
--- head/sbin/fdisk/fdisk.c	Sun Nov  6 21:11:22 2011	(r227279)
+++ head/sbin/fdisk/fdisk.c	Sun Nov  6 21:12:52 2011	(r227280)
@@ -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 d
 			printf("%s is an invalid decimal number.  Try again.\n",
 				lbuf);
 	}
-
 }
 
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201111062112.pA6LCqT7042268>