summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2018-10-18 16:14:59 +0200
committerLennart Poettering <lennart@poettering.net>2018-10-18 16:23:45 +0200
commit8ae29228a8bae50867d3729c1183b0734176c7d3 (patch)
treee0760967fb80d49bf8c1bc09e33b103aa4467d8d
parent7b26ea6f06c27edd6371a52f86872e21182244cf (diff)
downloadsystemd-8ae29228a8bae50867d3729c1183b0734176c7d3.tar.gz
bus-creds: FOREACH_LINE excorcism
-rw-r--r--src/libsystemd/sd-bus/bus-creds.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/libsystemd/sd-bus/bus-creds.c b/src/libsystemd/sd-bus/bus-creds.c
index a6dda16876..81d97ff968 100644
--- a/src/libsystemd/sd-bus/bus-creds.c
+++ b/src/libsystemd/sd-bus/bus-creds.c
@@ -803,10 +803,15 @@ int bus_creds_add_more(sd_bus_creds *c, uint64_t mask, pid_t pid, pid_t tid) {
else if (!IN_SET(errno, EPERM, EACCES))
return -errno;
} else {
- char line[LINE_MAX];
- FOREACH_LINE(line, f, return -errno) {
- truncate_nl(line);
+ for (;;) {
+ _cleanup_free_ char *line = NULL;
+
+ r = read_line(f, LONG_LINE_MAX, &line);
+ if (r < 0)
+ return r;
+ if (r == 0)
+ break;
if (missing & SD_BUS_CREDS_PPID) {
p = startswith(line, "PPid:");