From: Chang-Hsien Tsai Date: Sun, 26 May 2019 10:32:11 +0000 (+0000) Subject: bpf: style fix in while(!feof()) loop X-Git-Url: http://git.cdn.openwrt.org/?a=commitdiff_plain;h=92bd6820f2b11c2decdd92e1f9020e804dbc2ed1;p=openwrt%2Fstaging%2Fblogic.git bpf: style fix in while(!feof()) loop Use fgets() as the while loop condition. Signed-off-by: Chang-Hsien Tsai Acked-by: Yonghong Song Signed-off-by: Daniel Borkmann --- diff --git a/tools/bpf/bpftool/xlated_dumper.c b/tools/bpf/bpftool/xlated_dumper.c index 0bb17bf88b18..494d7ae3614d 100644 --- a/tools/bpf/bpftool/xlated_dumper.c +++ b/tools/bpf/bpftool/xlated_dumper.c @@ -31,9 +31,7 @@ void kernel_syms_load(struct dump_data *dd) if (!fp) return; - while (!feof(fp)) { - if (!fgets(buff, sizeof(buff), fp)) - break; + while (fgets(buff, sizeof(buff), fp)) { tmp = reallocarray(dd->sym_mapping, dd->sym_count + 1, sizeof(*dd->sym_mapping)); if (!tmp) { diff --git a/tools/testing/selftests/bpf/trace_helpers.c b/tools/testing/selftests/bpf/trace_helpers.c index 9a9fc6c9b70b..b47f205f0310 100644 --- a/tools/testing/selftests/bpf/trace_helpers.c +++ b/tools/testing/selftests/bpf/trace_helpers.c @@ -30,9 +30,7 @@ int load_kallsyms(void) if (!f) return -ENOENT; - while (!feof(f)) { - if (!fgets(buf, sizeof(buf), f)) - break; + while (fgets(buf, sizeof(buf), f)) { if (sscanf(buf, "%p %c %s", &addr, &symbol, func) != 3) break; if (!addr)