X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Fsysctl%2Fsysctl.c;h=db18dd9f6e69f7436813ae59de99a5844932f731;hb=e9dd9f9547350c7dc0473583b5c2228dc8f0ab76;hp=2d43660bb5285a8eaf5435f04a7be2bd8f2ec45f;hpb=a5c32cff1f56afe6f0c6c70d91a88a7a8238b2d7;p=elogind.git diff --git a/src/sysctl/sysctl.c b/src/sysctl/sysctl.c index 2d43660bb..db18dd9f6 100644 --- a/src/sysctl/sysctl.c +++ b/src/sysctl/sysctl.c @@ -88,7 +88,7 @@ static int apply_sysctl(const char *property, const char *value) { } } - k = write_one_line_file(p, value); + k = write_string_file(p, value); if (k < 0) { log_full(k == -ENOENT ? LOG_DEBUG : LOG_WARNING, "Failed to write '%s' to '%s': %s", value, p, strerror(-k)); @@ -125,7 +125,7 @@ static int parse_file(Hashmap *sysctl_options, const char *path, bool ignore_eno r = search_and_fopen_nulstr(path, "re", conf_file_dirs, &f); if (r < 0) { - if (ignore_enoent && errno == -ENOENT) + if (ignore_enoent && r == -ENOENT) return 0; log_error("Failed to open file '%s', ignoring: %s", path, strerror(-r)); @@ -149,7 +149,7 @@ static int parse_file(Hashmap *sysctl_options, const char *path, bool ignore_eno if (!*p) continue; - if (strchr(COMMENTS, *p)) + if (strchr(COMMENTS "\n", *p)) continue; value = strchr(p, '=');