projects
/
platform
/
upstream
/
systemd.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
741d2cb
)
cgtop: fgets() excorcism
author
Lennart Poettering
<lennart@poettering.net>
Thu, 18 Oct 2018 11:34:12 +0000
(13:34 +0200)
committer
Lennart Poettering
<lennart@poettering.net>
Thu, 18 Oct 2018 11:34:12 +0000
(13:34 +0200)
src/cgtop/cgtop.c
patch
|
blob
|
history
diff --git
a/src/cgtop/cgtop.c
b/src/cgtop/cgtop.c
index
1976d99
..
e4123e5
100644
(file)
--- 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 */