Age | Commit message (Collapse) | Author |
|
Currently, we save arguments passed as --prefix directly and compare them
later to absolute sysctl file-system paths. That is, you are required to
specify arguments to --prefix with leading /proc/sys/. This is kinda
uselesss. Furthermore, we replace dots by slashes in the name, which makes
it impossible to match on specific sysfs paths that have dots in their
name (like netdev names). The intention of this argument is clear, but it
never worked as expected.
This patch modifies --prefix to accept any kind of sysctl paths. It
supports paths prefixed with /proc/sys for compatibility (but drops the
erroneous dot->slash conversion), but instead applies normalize_sysctl()
which turns any name or path into a proper path. It then appends
/proc/sys/ so we can properly use it in matches.
Thanks to Jan Synacek <jsynacek@redhat.com> for catching this!
|
|
It is redundant to store 'hash' and 'compare' function pointers in
struct Hashmap separately. The functions always comprise a pair.
Store a single pointer to struct hash_ops instead.
systemd keeps hundreds of hashmaps, so this saves a little bit of
memory.
|
|
getopt is usually good at printing out a nice error message when
commandline options are invalid. It distinguishes between an unknown
option and a known option with a missing arg. It is better to let it
do its job and not use opterr=0 unless we actually want to suppress
messages. So remove opterr=0 in the few places where it wasn't really
useful.
When an error in options is encountered, we should not print a lengthy
help() and overwhelm the user, when we know precisely what is wrong
with the commandline. In addition, since help() prints to stdout, it
should not be used except when requested with -h or --help.
Also, simplify things here and there.
|
|
It turns out that plain sysctl understands a.b/c syntax to write to
/proc/sys/a/b.c. Support this for compatibility.
https://bugs.freedesktop.org/show_bug.cgi?id=77466
|
|
GCC optimizes strlen("string constant") to a constant, even with -O0.
Thus, replace patterns like sizeof("string constant")-1 with
strlen("string constant") where possible, for clarity. In particular,
for expressions intended to add up the lengths of components going into
a string, this often makes it clearer that the expression counts the
trailing '\0' exactly once, by putting the +1 for the '\0' at the end of
the expression, rather than hidden in a sizeof in the middle of the
expression.
|
|
This adds the same root argument to search_and_fopen that
conf_files_list already has. Tools that use those two functions as a
pair can now be easily modified to load configuration files from an
alternate root filesystem tree.
|
|
|
|
- turn strv_merge into strv_extend_strv.
appending strv b to the end of strv a instead of creating a new strv
- strv_append: remove in favor of strv_extend and strv_push.
- strv_remove: write slightly more elegant
- strv_remove_prefix: remove unused function
- strv_overlap: use strv_contains
- strv_printf: STRV_FOREACH handles NULL correctly
|
|
including it in the log strings
|
|
|
|
Among other things this makes sure we always expose a --version command
and show it in the help texts.
|
|
|
|
https://bugs.freedesktop.org/show_bug.cgi?id=63477
|
|
You can write much more than just one line with this call (and we
frequently do), so let's correct the naming.
|
|
Since fabe5c0e5fce730aa66e10a9c4f9fdd443d7aeda, systemd-sysctl returns
a non-zero exit code if /etc/sysctl.conf does not exist, due to a
broken ENOENT check.
|
|
Also split out some fileio functions to fileio.c and provide a SELinux
aware pendant in fileio-label.c
see https://bugzilla.redhat.com/show_bug.cgi?id=881577
|
|
src/sysctl/sysctl.c: In function ‘parse_file’:
src/sysctl/sysctl.c:172:41: warning: ‘property’ may be used uninitialized in this function [-Wmaybe-uninitialized]
|
|
that work on .d/ directories
This unifies much of the logic behind them:
- All four will now ofllow the rule that the earlier file and earlier
assignment in the .d/ directories wins. Before, sysctl was the only
outlier, where the later setting always won.
- All four now support getopt() and --help on the command line.
- All four can now handle specification of configuration file names on
the command line to apply. The tools will automatically find them, and
apply them. Previously only tmpfiles could do that. This is useful for
%post scripts in RPMs and suchlike.
- This fixes various error path issues in conf_files_list()
|
|
|
|
https://bugzilla.redhat.com/show_bug.cgi?id=869779
|
|
If the final key in any sysctl.d file is a duplicate, systemd-sysctl
will exit with an error (and no explaination why). Ignore this, as
duplicate keys are to be expected when overriding settings in the
directory hierarchy.
|
|
|
|
After if (r <= 0) r can't be 0 so
if (k < 0 && r == 0) never happens.
|
|
https://bugzilla.redhat.com/show_bug.cgi?id=767795
[ Simplified by iterating the config files in the backwards order -
no need for hashmap_update(). Other minor cleanups. -- michich ]
|
|
also a number of minor fixups and bug fixes: spelling, oom errors
that didn't print errors, not properly forwarding error codes,
few more consistency issues, et cetera
|
|
glibc/glib both use "out of memory" consistantly so maybe we should
consider that instead of this.
Eliminates one string out of a number of binaries. Also fixes extra newline
in udev/scsi_id
|
|
|
|
|
|
|