From 717e419b35d8a1144a579fb38999d6847f948b98 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Thu, 18 Oct 2018 13:34:12 +0200 Subject: [PATCH] cgtop: fgets() excorcism --- src/cgtop/cgtop.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/cgtop/cgtop.c b/src/cgtop/cgtop.c index 1976d99..e4123e5 100644 --- a/src/cgtop/cgtop.c +++ b/src/cgtop/cgtop.c @@ -343,10 +343,14 @@ static int process( } for (;;) { - char line[LINE_MAX], *l; + _cleanup_free_ char *line = NULL; uint64_t k, *q; + char *l; - if (!fgets(line, sizeof(line), f)) + r = read_line(f, LONG_LINE_MAX, &line); + if (r < 0) + return r; + if (r == 0) break; /* Trim and skip the device */ -- 2.7.4