summaryrefslogtreecommitdiff
path: root/src/shared/install.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2018-10-18 16:18:20 +0200
committerLennart Poettering <lennart@poettering.net>2018-10-18 16:23:45 +0200
commitbef77f378c4391e1baacd106944853639aa68517 (patch)
treeeebba65cdfdffd5968a34b640971396d93d3a295 /src/shared/install.c
parentd5b3c07da6997cde496cfb09ae47693ed13e79e2 (diff)
downloadsystemd-bef77f378c4391e1baacd106944853639aa68517.tar.gz
install: FOREACH_LINE excorcism
Diffstat (limited to 'src/shared/install.c')
-rw-r--r--src/shared/install.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/shared/install.c b/src/shared/install.c
index ccb999998c..61b713c6b6 100644
--- a/src/shared/install.c
+++ b/src/shared/install.c
@@ -15,6 +15,7 @@
#include "alloc-util.h"
#include "conf-files.h"
#include "conf-parser.h"
+#include "def.h"
#include "dirent-util.h"
#include "extract-word.h"
#include "fd-util.h"
@@ -2841,7 +2842,6 @@ static int read_presets(UnitFileScope scope, const char *root_dir, Presets *pres
STRV_FOREACH(p, files) {
_cleanup_fclose_ FILE *f;
- char line[LINE_MAX];
int n = 0;
f = fopen(*p, "re");
@@ -2852,11 +2852,18 @@ static int read_presets(UnitFileScope scope, const char *root_dir, Presets *pres
return -errno;
}
- FOREACH_LINE(line, f, return -errno) {
+ for (;;) {
+ _cleanup_free_ char *line = NULL;
PresetRule rule = {};
const char *parameter;
char *l;
+ r = read_line(f, LONG_LINE_MAX, &line);
+ if (r < 0)
+ return r;
+ if (r == 0)
+ break;
+
l = strstrip(line);
n++;