[PATCH 3/3] ls: match len's type with calc_name_len() result type

Guilherme Maciel Ferreira guilherme.maciel.ferreira at gmail.com
Sat Jul 26 17:37:05 UTC 2014


The variable len compares with 'column_width' and is assigned the
calc_name_len()'s result, both unsigned integers. Thus, the len variable
should be unsigned too.

Signed-off-by: Guilherme Maciel Ferreira <guilherme.maciel.ferreira at gmail.com>
---
 coreutils/ls.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/coreutils/ls.c b/coreutils/ls.c
index 1b63be5..c173c6b 100644
--- a/coreutils/ls.c
+++ b/coreutils/ls.c
@@ -661,7 +661,7 @@ static void display_files(struct dnode **dn, unsigned nfiles)
 	} else {
 		/* find the longest file name, use that as the column width */
 		for (i = 0; dn[i]; i++) {
-			int len = calc_name_len(dn[i]->name);
+			unsigned len = calc_name_len(dn[i]->name);
 			if (column_width < len)
 				column_width = len;
 		}
-- 
1.7.0.4



More information about the busybox mailing list