diff options
| author | Tiago Salem Herrmann <therrmann@suse.com> | 2017-12-12 13:43:17 -0200 |
|---|---|---|
| committer | Tiago Salem Herrmann <therrmann@suse.com> | 2017-12-13 15:03:33 -0200 |
| commit | a668bfe88a48d433a81dad8219bd98fc73838eda (patch) | |
| tree | 97312a87c3b97e7d8c2a8919256ced7b86cdefb1 /src/sysctl | |
| parent | 4a0e9289bf443fec9fc56af25f90e2a100ba7a41 (diff) | |
| download | systemd-a668bfe88a48d433a81dad8219bd98fc73838eda.tar.gz | |
Use read_line() and LONG_LINE_MAX to read values configuration files.
Diffstat (limited to 'src/sysctl')
| -rw-r--r-- | src/sysctl/sysctl.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/sysctl/sysctl.c b/src/sysctl/sysctl.c index 4c468d011a..a1dc95b2bb 100644 --- a/src/sysctl/sysctl.c +++ b/src/sysctl/sysctl.c @@ -106,16 +106,16 @@ static int parse_file(OrderedHashmap *sysctl_options, const char *path, bool ign log_debug("Parsing %s", path); for (;;) { - char l[LINE_MAX], *p, *value, *new_value, *property, *existing; + char *p, *value, *new_value, *property, *existing; + _cleanup_free_ char *l = NULL; void *v; int k; + k = read_line(f, LONG_LINE_MAX, &l); + if (k == 0) + break; - if (!fgets(l, sizeof(l), f)) { - if (feof(f)) - break; - - return log_error_errno(errno, "Failed to read file '%s', ignoring: %m", path); - } + if (k < 0) + return log_error_errno(k, "Failed to read file '%s', ignoring: %m", path); c++; |
