From owner-svn-src-all@FreeBSD.ORG Sun Nov 6 21:12:52 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B91C11065675; Sun, 6 Nov 2011 21:12:52 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A98218FC0A; Sun, 6 Nov 2011 21:12:52 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pA6LCqZu042270; Sun, 6 Nov 2011 21:12:52 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pA6LCqT7042268; Sun, 6 Nov 2011 21:12:52 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201111062112.pA6LCqT7042268@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Sun, 6 Nov 2011 21:12:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r227280 - head/sbin/fdisk X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Nov 2011 21:12:52 -0000 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); } - }