[PATCH 1/3] tail: turn i to unsigned integer

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


The variable i is used only to index and to be assigned to other unsigned
integers.

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

diff --git a/coreutils/tail.c b/coreutils/tail.c
index e352ab6..c44aeb8 100644
--- a/coreutils/tail.c
+++ b/coreutils/tail.c
@@ -100,7 +100,8 @@ int tail_main(int argc, char **argv)
 	size_t tailbufsize;
 	unsigned header_threshhold = 1;
 	unsigned nfiles;
-	int i, opt;
+	unsigned i;
+	int opt;
 
 	int *fds;
 	const char *fmt;
@@ -161,7 +162,7 @@ int tail_main(int argc, char **argv)
 		}
 		fds[nfiles] = fd;
 		argv[nfiles++] = argv[i];
-	} while (++i < argc);
+	} while (++i < (unsigned) argc);
 
 	if (!nfiles)
 		bb_error_msg_and_die("no files");
-- 
1.7.0.4



More information about the busybox mailing list