From 74324c86663f57a19c1de303ee8c8e5449db9ef2 Mon Sep 17 00:00:00 2001 From: Denis Vlasenko Date: Mon, 4 Jun 2007 10:16:52 +0000 Subject: Audit bb_common_bufsiz usage, add script which looks for misuse. tr: stop using globals needlessly. code: -103 bytes --- networking/hostname.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'networking/hostname.c') diff --git a/networking/hostname.c b/networking/hostname.c index 50ef7b5d1..862bbdfa2 100644 --- a/networking/hostname.c +++ b/networking/hostname.c @@ -29,12 +29,13 @@ static void do_sethostname(char *s, int isfile) } } else { f = xfopen(s, "r"); - while (fgets(bb_common_bufsiz1, sizeof(bb_common_bufsiz1), f) != NULL) { - if (bb_common_bufsiz1[0] == '#') { +#define strbuf bb_common_bufsiz1 + while (fgets(strbuf, sizeof(strbuf), f) != NULL) { + if (strbuf[0] == '#') { continue; } - chomp(bb_common_bufsiz1); - do_sethostname(bb_common_bufsiz1, 0); + chomp(strbuf); + do_sethostname(strbuf, 0); } if (ENABLE_FEATURE_CLEAN_UP) fclose(f); -- cgit v1.2.3