On Wed, 04.02.15 10:43, Umut Tezduyar Lindskog (umut.tezdu...@axis.com) wrote:
> not while applying the parsed sysctl values. Otherwise > info "Overwriting earlier assignment of %s in file %s" is > visible many times even though the given --prefix doesn't > try to set the overridden value. Looks conceptually OK. A few notes: > k = write_string_file(p, value); > if (k < 0) { > log_full(k == -ENOENT ? LOG_DEBUG : LOG_WARNING, > @@ -173,6 +157,24 @@ static int parse_file(Hashmap *sysctl_options, const > char *path, bool ignore_eno > p = normalize_sysctl(strstrip(p)); > value = strstrip(value); > > + if (!strv_isempty(arg_prefixes)) { > + char **i, *t; > + bool good = false; > + STRV_FOREACH(i, arg_prefixes) { > + t = *i; > + if (startswith(t, "/proc/sys/")) { > + t = t + strlen("/proc/sys/"); > + } Please use path_startswith() jhere. Also, startswith() and path_startswith() actually return a pointer to the first char after the spefied prefix. If you want to skip the prefix anyway, it's nice to use that. Also, please no {} around singl-line code blocks. > + if (path_startswith(p, t)) { > + good = true; > + break; > + } > + } > + if (!good) { > + continue; > + } No {} around single-line code blocks. Lennart -- Lennart Poettering, Red Hat _______________________________________________ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel