diff options
author | Lennart Poettering <lennart@poettering.net> | 2018-10-18 13:34:12 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2018-10-18 13:34:12 +0200 |
commit | 717e419b35d8a1144a579fb38999d6847f948b98 (patch) | |
tree | c159c1b30dcca8ee3a3fabc8eb672f0c1fc54f1e | |
parent | 741d2cb533cb939fe57f5a59f011961b407cf7f2 (diff) | |
download | systemd-717e419b35d8a1144a579fb38999d6847f948b98.tar.gz |
cgtop: fgets() excorcism
-rw-r--r-- | src/cgtop/cgtop.c | 8 |
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 */ |