From 97cde50b359781548ab1663010ca939e0f04e9cd Mon Sep 17 00:00:00 2001 From: Craig Small Date: Sat, 24 Oct 2015 13:17:36 +1100 Subject: [PATCH] free: use correct end sentinel MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit When scaling values, the last item was integer 0 but the loop checked for character '0'. This was reported by 付腾桂 Thanks for the report and patch. --- free.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/free.c b/free.c index 6c72138c..f86ab951 100644 --- a/free.c +++ b/free.c @@ -148,7 +148,7 @@ static const char *scale_size(unsigned long size, int flags, struct commandline_ /* human readable output */ up = nextup; - for (i = 1; up[0] != '0'; i++, up++) { + for (i = 1; up[0] != 0; i++, up++) { switch (i) { case 1: if (4 >= snprintf(buf, sizeof(buf), "%ld%c", (long)size * 1024, *up)) -- 2.40.0