chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
everywhere: remove configurability of sysv runlevel to target mapping
[elogind.git]
/
src
/
sysctl
/
sysctl.c
diff --git
a/src/sysctl/sysctl.c
b/src/sysctl/sysctl.c
index 346ff3b2378dba1b172469820921b97aa4ebf4ee..275a5b74aee4669c22cf8a4eebff42b83fb1f4a7 100644
(file)
--- a/
src/sysctl/sysctl.c
+++ b/
src/sysctl/sysctl.c
@@
-78,22
+78,6
@@
static int apply_sysctl(const char *property, const char *value) {
n = stpcpy(p, "/proc/sys/");
strcpy(n, property);
n = stpcpy(p, "/proc/sys/");
strcpy(n, property);
- if (!strv_isempty(arg_prefixes)) {
- char **i;
- bool good = false;
-
- STRV_FOREACH(i, arg_prefixes)
- if (path_startswith(p, *i)) {
- good = true;
- break;
- }
-
- if (!good) {
- log_debug("Skipping %s", p);
- return 0;
- }
- }
-
k = write_string_file(p, value);
if (k < 0) {
log_full(k == -ENOENT ? LOG_DEBUG : LOG_WARNING,
k = write_string_file(p, value);
if (k < 0) {
log_full(k == -ENOENT ? LOG_DEBUG : LOG_WARNING,
@@
-134,8
+118,7
@@
static int parse_file(Hashmap *sysctl_options, const char *path, bool ignore_eno
if (ignore_enoent && r == -ENOENT)
return 0;
if (ignore_enoent && r == -ENOENT)
return 0;
- log_error_errno(r, "Failed to open file '%s', ignoring: %m", path);
- return r;
+ return log_error_errno(r, "Failed to open file '%s', ignoring: %m", path);
}
log_debug("parse: %s", path);
}
log_debug("parse: %s", path);
@@
-148,7
+131,7
@@
static int parse_file(Hashmap *sysctl_options, const char *path, bool ignore_eno
if (feof(f))
break;
if (feof(f))
break;
- log_error
(
"Failed to read file '%s', ignoring: %m", path);
+ log_error
_errno(errno,
"Failed to read file '%s', ignoring: %m", path);
return -errno;
}
return -errno;
}
@@
-174,6
+157,20
@@
static int parse_file(Hashmap *sysctl_options, const char *path, bool ignore_eno
p = normalize_sysctl(strstrip(p));
value = strstrip(value);
p = normalize_sysctl(strstrip(p));
value = strstrip(value);
+ if (!strv_isempty(arg_prefixes)) {
+ char **i, *t;
+ STRV_FOREACH(i, arg_prefixes) {
+ t = path_startswith(*i, "/proc/sys/");
+ if (t == NULL)
+ t = *i;
+ if (path_startswith(p, t))
+ goto found;
+ }
+ /* not found */
+ continue;
+ }
+
+found:
existing = hashmap_get2(sysctl_options, p, &v);
if (existing) {
if (streq(value, existing))
existing = hashmap_get2(sysctl_options, p, &v);
if (existing) {
if (streq(value, existing))