summaryrefslogtreecommitdiff
path: root/src/cgtop
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2018-10-18 13:34:12 +0200
committerLennart Poettering <lennart@poettering.net>2018-10-18 13:34:12 +0200
commit717e419b35d8a1144a579fb38999d6847f948b98 (patch)
treec159c1b30dcca8ee3a3fabc8eb672f0c1fc54f1e /src/cgtop
parent741d2cb533cb939fe57f5a59f011961b407cf7f2 (diff)
downloadsystemd-717e419b35d8a1144a579fb38999d6847f948b98.tar.gz
cgtop: fgets() excorcism
Diffstat (limited to 'src/cgtop')
-rw-r--r--src/cgtop/cgtop.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/cgtop/cgtop.c b/src/cgtop/cgtop.c
index 1976d99597..e4123e5f07 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 */