From: Lennart Poettering Date: Thu, 18 Oct 2018 11:34:12 +0000 (+0200) Subject: cgtop: fgets() excorcism X-Git-Tag: v240~514^2~8 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=717e419b35d8a1144a579fb38999d6847f948b98;p=platform%2Fupstream%2Fsystemd.git cgtop: fgets() excorcism --- 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 */