chiark / gitweb /
Zbigniew Jędrzejewski-Szmek [Sat, 19 May 2018 15:02:37 +0000 (17:02 +0200)]
rpm: add macros for common configuration dirs
%_environmnentdir /usr/lib/environment.d
%_modulesloaddir /usr/lib/modules-load.d
%_modprobedir /usr/lib/modprobe.d
This makes installing files there more convenient because people don't need to
construct the path from %_prefix/lib/… .
See https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org/thread/GBF5WJLTQVSXMHGYGBF3723ZYCWFBR7C/.
Lennart Poettering [Fri, 18 May 2018 18:14:54 +0000 (20:14 +0200)]
fs-util: don't alter errno in unlink_tempfilep()
Functions whose only purpose is to be used with _cleanup_() should not
touch errno, so that failing removals do not alter errno at unexpected
places.
This is already done in unlink_and_freep(), rmdir_and_freep(),
rm_rf_physical_and_freep(), hence do so for unlink_tempfilep(), too.
Follow-up for #9013
Evegeny Vereshchagin [Fri, 18 May 2018 10:52:17 +0000 (10:52 +0000)]
meson: use run_target for generating tags with ctags
In https://github.com/systemd/systemd/pull/6561, `run_target`
was changed to `custom_target`, which inadvertently caused
relative paths to be passed to ctags due to
https://github.com/mesonbuild/meson/issues/3589.
The switch to `run_target` causes absolute paths to be
passed again and makes it easier to jump from file to
file, hopefully delaying the need to exit Vim :-)
Zbigniew Jędrzejewski-Szmek [Fri, 11 May 2018 09:09:37 +0000 (11:09 +0200)]
Use STRLEN in two places
Zbigniew Jędrzejewski-Szmek [Mon, 14 May 2018 07:20:17 +0000 (09:20 +0200)]
test-copy: remove unnecessary initialization
Initializing just some of the values doesn't make sense. We should handle them
all in the same way. In those tests there are no jumps, all steps are covered
with assert_se(), so we know everything will be set if we get to the end of the
function. And _not_ initializing those variables has the advantage that it
allows valgrind to catch potential initalization errors in the function being
tested.
Zbigniew Jędrzejewski-Szmek [Mon, 14 May 2018 07:12:12 +0000 (09:12 +0200)]
tree-wide: do not wrap assert_se in extra parentheses
We were inconsitently using them in some cases, but in majority not.
Using assignment in assert_se is very common, not an exception like in
'if', so let's drop the extra parens everywhere.
Zbigniew Jędrzejewski-Szmek [Mon, 14 May 2018 06:50:00 +0000 (08:50 +0200)]
core/mount-setup: remove part of check which is always true
f1470e424b2b5337e3c383d68dc5a26af1ff4ce6 removed one check, but missed a similar
one a few lines down.
CID #
1390949.
Yu Watanabe [Mon, 14 May 2018 01:02:55 +0000 (10:02 +0900)]
login: use BUS_DEFINE_PROPERTY_GET* macros
Yu Watanabe [Mon, 14 May 2018 01:02:17 +0000 (10:02 +0900)]
bus-util: add more macros for defining functions of getting dbus properties
Zbigniew Jędrzejewski-Szmek [Wed, 16 May 2018 09:35:41 +0000 (11:35 +0200)]
fs-util,test: add helper to remove tempfiles
This simplifies the use of tempfiles in tests and fixes "leaked"
temporary files in test-fileio, test-catalog, test-conf-parser.
Not the whole tree is converted.
Lennart Poettering [Wed, 25 Apr 2018 09:23:01 +0000 (11:23 +0200)]
path-util: one more empty_or_root() change
Lennart Poettering [Mon, 7 May 2018 18:44:41 +0000 (20:44 +0200)]
process-util: add new helper call for adjusting the OOM score
And let's make use of it in execute.c
Lennart Poettering [Mon, 7 May 2018 18:26:38 +0000 (20:26 +0200)]
basic: split parsing of the OOM score adjust value into its own function in parse-util.c
And port config_parse_exec_oom_score_adjust() over to use it.
While we are at it, let's also fix config_parse_exec_oom_score_adjust()
to accept an empty string for turning off OOM score adjustments set
earlier.
Lennart Poettering [Mon, 7 May 2018 16:18:11 +0000 (18:18 +0200)]
conf-parser: shorten config_parse_string() by using free_and_strdup() and empty_to_null()
Lennart Poettering [Mon, 7 May 2018 15:54:59 +0000 (17:54 +0200)]
basic: be more careful when closing fds based on RLIMIT_NOFILE
Let's make sure we properly handle cases where RLIMIT_NOFILE is set to
infinity, zero or values outside of the "int" range.
Lennart Poettering [Thu, 3 May 2018 17:01:21 +0000 (19:01 +0200)]
core: move config_parse_limit() to the generic conf-parser.[ch]
That way we can use it in nspawn.
Also, while we are at it, let's rename the call config_parse_rlimit(),
i.e. insert the "r", to clarify what kind of limit this is about.
Lennart Poettering [Thu, 3 May 2018 16:45:39 +0000 (18:45 +0200)]
rlimit-util: rework rlimit_{from|to}_string() to work without "Limit" prefix
let's make the call more generic, so that we can also easily use it for
parsing "RLIMIT_xyz" style constants.
David Tardon [Thu, 17 May 2018 13:45:37 +0000 (15:45 +0200)]
inhibit: use pager for systemd-inhibit --list
Zbigniew Jędrzejewski-Szmek [Sun, 13 May 2018 20:28:24 +0000 (22:28 +0200)]
Turn VALGRIND variable into a meson configuration switch
Configuration through environment variable is inconvenient with meson, because
they cannot be convieniently changed and/or are not preserved during
reconfiguration (https://github.com/mesonbuild/meson/issues/1503).
This adds -Dvalgrind=true/false, which has the advantage that it can be set
at any time with meson configure -Dvalgrind=... and ninja will rebuild targets
as necessary. Additional minor advantages are better consistency with the
options for hashmap debugging, and typo avoidance with '#if' instead of '#ifdef'.
Felipe Sateler [Tue, 15 May 2018 18:12:22 +0000 (14:12 -0400)]
core: Break circular dependency between unit.h and cgroup.h
Yu Watanabe [Wed, 2 May 2018 04:56:28 +0000 (13:56 +0900)]
meson: use array type option
Array type option is supported since 0.44.0.
Yu Watanabe [Thu, 10 May 2018 05:50:52 +0000 (14:50 +0900)]
meson: use warning() method
This bumps the required minimum version of meson to 0.44, as
`warning()` method is supported since 0.44.
Yu Watanabe [Thu, 10 May 2018 06:30:42 +0000 (15:30 +0900)]
meson: use get_supported_arguments()
This bumps the required minimum version of meson to 0.43, as
`get_supported_arguments()` is supported since meson-0.43.
Yu Watanabe [Mon, 14 May 2018 05:14:17 +0000 (14:14 +0900)]
test: use _cleanup_hashmap_free_ instread of _cleanup_(hashmap_freep)
Yu Watanabe [Mon, 14 May 2018 05:09:03 +0000 (14:09 +0900)]
sd-bus: use free_and_strdup()
Yu Watanabe [Sun, 13 May 2018 03:20:51 +0000 (12:20 +0900)]
bus-util: add several macros for defining functions of getting dbus properties
Mike Gilbert [Sat, 12 May 2018 19:20:13 +0000 (15:20 -0400)]
basic: add log_level argument to timezone_is_valid
Mike Gilbert [Thu, 10 May 2018 19:10:48 +0000 (15:10 -0400)]
basic: timezone_is_valid: check for magic bytes "TZif"
Fixes: https://github.com/systemd/systemd/issues/8905
Yu Watanabe [Fri, 11 May 2018 06:01:35 +0000 (15:01 +0900)]
test: do not call alloca() inside the list of arguments
Yu Watanabe [Fri, 11 May 2018 04:56:28 +0000 (13:56 +0900)]
hexdecoct: drop an unnecessary check
Yu Watanabe [Fri, 11 May 2018 04:55:28 +0000 (13:55 +0900)]
basic: fix comment style
Yu Watanabe [Fri, 11 May 2018 05:36:22 +0000 (14:36 +0900)]
hexdecoct: ignore whitespace within the input hexadecimal text of unhexmem()
Lennart Poettering [Thu, 10 May 2018 18:28:33 +0000 (11:28 -0700)]
terminal-util: add a function that shows a pretty separator line
Follow-up for #8824
Yu Watanabe [Thu, 10 May 2018 16:55:46 +0000 (01:55 +0900)]
string-util: rename strdash_if_empty() to empty_to_dash()
Yu Watanabe [Thu, 10 May 2018 16:47:33 +0000 (01:47 +0900)]
path-util: introduce empty_to_root() and use it many places
Zbigniew Jędrzejewski-Szmek [Fri, 27 Apr 2018 07:39:53 +0000 (09:39 +0200)]
basic/terminal-util: fix output of files without a final newline
If the main config file or one of the drop-ins did not have the final newline,
there would be no seperating empty line (or if this was the last file
displayed, our own output would end without the final newline, possibly running
into the subsequent prompt or such). copy_bytes() does not know anything about
lines, so let's just use a normal loop with read_line() and puts().
Zbigniew Jędrzejewski-Szmek [Fri, 27 Apr 2018 06:55:16 +0000 (08:55 +0200)]
analyze: add --root option for cat-config
Zbigniew Jędrzejewski-Szmek [Thu, 26 Apr 2018 18:38:39 +0000 (20:38 +0200)]
sysusers: add --cat-config
Zbigniew Jędrzejewski-Szmek [Thu, 26 Apr 2018 17:07:54 +0000 (19:07 +0200)]
tmpfiles: add --cat-config
This implements similar logic as conf_files_cat(), but with slightly different
file gathering logic. I also want to add support for replacement files later on,
so it seems better to keep those two file-gathering functions separate.
Zbigniew Jędrzejewski-Szmek [Thu, 26 Apr 2018 11:49:50 +0000 (13:49 +0200)]
analyze: add 'cat-config' verb
This is used as 'systemd-analyze show-config systemd/logind.conf', which
will dump
/etc/systemd/system/user@.service
/etc/systemd/system/user@.service.d/*.conf
/run/systemd/system/user@.service.d/*.conf
/usr/local/lib/systemd/system/user@.service.d/*.conf
/usr/lib/systemd/system/user@.service.d/*.conf
The idea is to make it easy to dump the configuration using the same locations
and order that systemd programs use themselves (including masking, in the right
order, etc.). This is the generic variant that works with any configuration
scheme that follows the same general rules:
$ systemd-analyze cat-config systemd/system.conf
$ systemd-analyze cat-config systemd/user.conf
$ systemd-analyze cat-config systemd/logind.conf
$ systemd-analyze cat-config systemd/sleep.conf
$ systemd-analyze cat-config systemd/journald.conf
$ systemd-analyze cat-config systemd/journal-remote.conf
$ systemd-analyze cat-config systemd/journal-upload.conf
$ systemd-analyze cat-config systemd/coredump.conf
$ systemd-analyze cat-config systemd/resolved.conf
$ systemd-analyze cat-config systemd/timesyncd.conf
$ systemd-analyze cat-config udev/udev.conf
Zbigniew Jędrzejewski-Szmek [Thu, 26 Apr 2018 11:03:39 +0000 (13:03 +0200)]
Move function to cat file & dropins into basic/
This fixes a buglet where the second and later drop-in would not be seperated
properly by a newline.
David Tardon [Thu, 10 May 2018 13:55:56 +0000 (15:55 +0200)]
sd-bus: use automatic cleanup more
David Tardon [Thu, 10 May 2018 12:10:53 +0000 (14:10 +0200)]
basic: use automatic cleanup more
David Tardon [Thu, 10 May 2018 12:08:35 +0000 (14:08 +0200)]
basic: use automatic cleanup more
Zbigniew Jędrzejewski-Szmek [Thu, 10 May 2018 00:03:23 +0000 (02:03 +0200)]
core/mount-setup: remove part of check which is always true
k was set to join_controllers at this point and only incremented, so
it cannot be null at this point.
CID #
1390949.
Zbigniew Jędrzejewski-Szmek [Wed, 9 May 2018 23:55:05 +0000 (01:55 +0200)]
basic/fs-util: remove logically dead code
We can jump to chase_one from two places. In the first 'todo' is set to
'buffer', which comes from path_make_absolute_cwd() and is nonnull In the
second 'todo' is set to 'joined' which is checked to be nonull a few lines
above the jump. So let's kill the code that deals with null todo there.
CID #
1390941.
Zbigniew Jędrzejewski-Szmek [Wed, 9 May 2018 23:34:33 +0000 (01:34 +0200)]
logind: fix borked r check
CID #
1390947, #
1390952.
Zbigniew Jędrzejewski-Szmek [Wed, 9 May 2018 23:22:29 +0000 (01:22 +0200)]
basic/format-table: add missing va_end()
CID #
1390930, #
1390940.
Zbigniew Jędrzejewski-Szmek [Wed, 9 May 2018 23:04:53 +0000 (01:04 +0200)]
shared/sleep-config: fix memleak of strv, add test
CID #
1390921, #
1390951.
Filipe Brandenburger [Thu, 10 May 2018 01:10:07 +0000 (18:10 -0700)]
conf-parser: accept trailing backslash at the end of the file (#8941)
This makes it behave the same whether there is a blank line or not at
the end of the file. This is also consistent with the behavior of the
shell on a shell script that ends on a trailing backslash at the last
line.
Added tests to test_config_parse(), which only pass if the corresponding
change to config_parse() is included.
Zbigniew Jędrzejewski-Szmek [Wed, 25 Apr 2018 13:29:48 +0000 (15:29 +0200)]
meson: recompile all sources for install_libudev_static and install_libsystemd_static
This means that when those targets are built, all the sources are built again,
instead of reusing the work done to create libbasic.a and other convenience static
libraries. It would be nice to not do this, but there seems to be no support in
our toolchain for joining multiple static libraries into one. When linking
a static library, any -l arguments are simply ignored by ar/gcc-ar, and .a
libraries given as positional arguments are copied verbatim into the archive
so they objects in them cannot be accessed.
https://stackoverflow.com/questions/
2157629/linking-static-libraries-to-other-static-libraries
suggests either unzipping all the archives and putting them back togather,
or using a linker script. Unzipping and zipping back together seems ugly.
The other option is not very nice. The linker script language does not
allow "+" to appear in the filenames, and filenames that meson generates
use that, so files would have to be renamed before a linker script was used.
And we would have to generate the linker script on the fly. Either way, this
doesn't seem attractive. Since those static libraries are a niche use case,
it seems reasonable to just go with the easiest and safest solution and
recompile all the source files. Thanks to ccache, this is probably almost as
cheap as actually reusing the convenience .a libraries.
test-libsystemd-sym.c and test-libudev-sym.c compile fine with the generated
static libs, so it seems that they indeed provide all the symbols they should.
Davide Cavalca [Tue, 24 Apr 2018 20:34:48 +0000 (13:34 -0700)]
meson: only build test-lib{systemd,udev}-static-sym for pic
Zbigniew Jędrzejewski-Szmek [Mon, 23 Apr 2018 11:49:27 +0000 (13:49 +0200)]
meson: add test-lib{systemd,udev}-static-sym
This is the same as test-lib{systemd,udev}-sym, but linked to the static
variants of those libraries.
Davide Cavalca [Mon, 9 Apr 2018 09:43:35 +0000 (02:43 -0700)]
meson: add support for building static libsystemd and libudev
Yu Watanabe [Wed, 9 May 2018 15:34:46 +0000 (00:34 +0900)]
tree-wide: use strv_free_and_replace() macro
Yu Watanabe [Wed, 9 May 2018 13:50:07 +0000 (22:50 +0900)]
time-util: fix indentation for comments
Zbigniew Jędrzejewski-Szmek [Wed, 9 May 2018 07:44:37 +0000 (09:44 +0200)]
sd-bus: add bus_freep and use _cleanup_
Zbigniew Jędrzejewski-Szmek [Wed, 9 May 2018 07:35:01 +0000 (09:35 +0200)]
sd-bus: use automatic cleanup more
Zbigniew Jędrzejewski-Szmek [Wed, 9 May 2018 07:25:03 +0000 (09:25 +0200)]
sd-bus: trivial simplification
David Tardon [Wed, 9 May 2018 08:33:28 +0000 (10:33 +0200)]
use max. message size allowed by DBus spec (#8936)
C.f. https://dbus.freedesktop.org/doc/dbus-specification.html#message-protocol-messages.
Yu Watanabe [Wed, 9 May 2018 08:06:46 +0000 (17:06 +0900)]
bus-util: print a friendly message when PID1 is not systemd
Follow-up for
861f16d2679eeda79e8185057cef24653913e300.
Fixes #8913.
Yu Watanabe [Mon, 7 May 2018 01:16:04 +0000 (10:16 +0900)]
login: do not wall message on cancelling shutdown when Manager.enable_wall_messages is false
Fixes #8904.
Yu Watanabe [Mon, 7 May 2018 01:13:54 +0000 (10:13 +0900)]
login: change variable type of enable_wall_messages as it matches Manager.enable_wall_messages
Lennart Poettering [Mon, 30 Apr 2018 19:20:31 +0000 (21:20 +0200)]
update TODO
Yu Watanabe [Tue, 8 May 2018 01:14:02 +0000 (10:14 +0900)]
man: update references to systemd-journal-{remote,upload}
Fixes #8920 and #8921.
Yu Watanabe [Mon, 7 May 2018 09:17:35 +0000 (18:17 +0900)]
meson: generate m4 preprocessor from config.h (#8914)
Yu Watanabe [Mon, 30 Apr 2018 13:42:40 +0000 (22:42 +0900)]
man: add explanations of show-timesync and timesync-status commands
Yu Watanabe [Thu, 3 May 2018 09:07:43 +0000 (18:07 +0900)]
timedatectl: add timesync-status and show-timesync commands
Closes #1589.
Yu Watanabe [Thu, 3 May 2018 07:47:12 +0000 (16:47 +0900)]
test: add tests for signal_from_string()
Yu Watanabe [Thu, 3 May 2018 07:38:57 +0000 (16:38 +0900)]
util: rename signal_from_string_try_harder() to signal_from_string()
Also this makes the new `signal_from_string()` function reject
e.g, `SIG3` or `SIG+5`.
Yu Watanabe [Thu, 3 May 2018 07:40:02 +0000 (16:40 +0900)]
util: make signal_from_string() accept RTMIN, RTMAX, and RTMAX-n
Before this, `signal_from_string()` accepts simple signal name
or RTMIN+n. This makes the function also accept RTMIN, RTMAX,
and RTMAX-n.
Note that RTMIN+0 is equivalent to RTMIN, and RTMAX-0 is to RTMAX.
This also fixes the integer overflow reported by oss-fuzz #8064.
https://oss-fuzz.com/v2/testcase-detail/
5648573352902656
Sven Eden [Fri, 10 Aug 2018 15:31:26 +0000 (17:31 +0200)]
meson.build: Fix new executable systemd-user-runtime-dir, that we do not need.
Lennart Poettering [Mon, 30 Apr 2018 10:24:57 +0000 (12:24 +0200)]
virt: simplifications
Let's simplify the code a bit. Let's reduce the number of redundant if
checks a bit, (i.e. if we want to check for equality with
VIRTUALIZATION_VM_OTHER there's no need to check for non-equality with
VIRTUALIZATION_NONE first). As a very welcome side-effect this means we
lose some lines of code and our level of indentation is reduced.
No changes in behaviour.
Lennart Poettering [Mon, 30 Apr 2018 10:23:03 +0000 (12:23 +0200)]
virt: if we detect Xen by DMI, trust that over CPUID
Apparently Xen sometimes lies about its identity when queried via CPUID.
Let's hence prefer DMI tests for CPUID
Fixes: #8844
Sven Eden [Fri, 10 Aug 2018 05:57:45 +0000 (07:57 +0200)]
pwx: Use latest check_tree.pl revision.
Yu Watanabe [Thu, 3 May 2018 07:47:12 +0000 (16:47 +0900)]
test: add tests for signal_from_string()
Yu Watanabe [Thu, 3 May 2018 07:38:57 +0000 (16:38 +0900)]
util: rename signal_from_string_try_harder() to signal_from_string()
Also this makes the new `signal_from_string()` function reject
e.g, `SIG3` or `SIG+5`.
Yu Watanabe [Thu, 3 May 2018 07:40:02 +0000 (16:40 +0900)]
util: make signal_from_string() accept RTMIN, RTMAX, and RTMAX-n
Before this, `signal_from_string()` accepts simple signal name
or RTMIN+n. This makes the function also accept RTMIN, RTMAX,
and RTMAX-n.
Note that RTMIN+0 is equivalent to RTMIN, and RTMAX-0 is to RTMAX.
This also fixes the integer overflow reported by oss-fuzz #8064.
https://oss-fuzz.com/v2/testcase-detail/
5648573352902656
Yu Watanabe [Wed, 2 May 2018 08:05:51 +0000 (17:05 +0900)]
meson: drop 'name' argument in cc.has_argument() (#8878)
Sven Eden [Wed, 8 Aug 2018 06:00:08 +0000 (08:00 +0200)]
Bump pwx migration tools and fix doubled line in meson.build.
Lennart Poettering [Mon, 30 Apr 2018 10:24:57 +0000 (12:24 +0200)]
virt: simplifications
Let's simplify the code a bit. Let's reduce the number of redundant if
checks a bit, (i.e. if we want to check for equality with
VIRTUALIZATION_VM_OTHER there's no need to check for non-equality with
VIRTUALIZATION_NONE first). As a very welcome side-effect this means we
lose some lines of code and our level of indentation is reduced.
No changes in behaviour.
Lennart Poettering [Mon, 30 Apr 2018 10:23:03 +0000 (12:23 +0200)]
virt: if we detect Xen by DMI, trust that over CPUID
Apparently Xen sometimes lies about its identity when queried via CPUID.
Let's hence prefer DMI tests for CPUID
Fixes: #8844
Lennart Poettering [Thu, 3 May 2018 14:15:04 +0000 (16:15 +0200)]
locale-util: add comment with link to unicode chars supported by eurlatgr (#8894)
See: #6443
Lennart Poettering [Thu, 3 May 2018 14:10:35 +0000 (16:10 +0200)]
mount-setup: add a comment that the character/block device nodes are "optional" (#8893)
if we lack privs to create device nodes that's fine, and creating
/run/systemd/inaccessible/chr or /run/systemd/inaccessible/blk won't
work then. Document this in longer comments.
Fixes: #4484
Yu Watanabe [Thu, 3 May 2018 07:47:12 +0000 (16:47 +0900)]
test: add tests for signal_from_string()
Yu Watanabe [Thu, 3 May 2018 07:38:57 +0000 (16:38 +0900)]
util: rename signal_from_string_try_harder() to signal_from_string()
Also this makes the new `signal_from_string()` function reject
e.g, `SIG3` or `SIG+5`.
Yu Watanabe [Thu, 3 May 2018 07:40:02 +0000 (16:40 +0900)]
util: make signal_from_string() accept RTMIN, RTMAX, and RTMAX-n
Before this, `signal_from_string()` accepts simple signal name
or RTMIN+n. This makes the function also accept RTMIN, RTMAX,
and RTMAX-n.
Note that RTMIN+0 is equivalent to RTMIN, and RTMAX-0 is to RTMAX.
This also fixes the integer overflow reported by oss-fuzz #8064.
https://oss-fuzz.com/v2/testcase-detail/
5648573352902656
Lennart Poettering [Thu, 3 May 2018 13:13:42 +0000 (15:13 +0200)]
update TODO
Yu Watanabe [Wed, 2 May 2018 08:54:52 +0000 (17:54 +0900)]
set: drop unused set_make() function (#8879)
The function causes compiler error when built with '-Ddebug=hashmap',
and is not used anymore. Let's drop it.
Yu Watanabe [Wed, 2 May 2018 08:05:51 +0000 (17:05 +0900)]
meson: drop 'name' argument in cc.has_argument() (#8878)
Adam Duskett [Wed, 2 May 2018 08:04:50 +0000 (04:04 -0400)]
add __nr_statx defines for extra architectures (#8872)
This includes:
- arm
- arm64
- alpha
- powerpc64
- sparc
Taken from kernel 4.16.6
Lennart Poettering [Fri, 27 Apr 2018 19:31:43 +0000 (21:31 +0200)]
update TODO
Lennart Poettering [Tue, 24 Apr 2018 16:16:14 +0000 (18:16 +0200)]
logind: (void)ify all things we knowingly ignore
Lennart Poettering [Tue, 24 Apr 2018 16:14:25 +0000 (18:14 +0200)]
logind: terminate cleanly on SIGTERM/SIGINT
Let's properly terminate on SIGTERM or SIGINT. Previously we'd just rely
on the implicit process clean-up logic on UNIX. By shutting down
properly on SIGTERM/SIGINT we make it easier to track down memory leaks
by employing valgrind.
Lennart Poettering [Tue, 24 Apr 2018 16:13:12 +0000 (18:13 +0200)]
logind: modernize Manager object allocation and freeing
Let's propagate errors correctly, and stick to the usual naming and
behaviour of these functions. Or in other words, make this closer to the
matching code in machined.
Zbigniew Jędrzejewski-Szmek [Fri, 27 Apr 2018 16:00:58 +0000 (18:00 +0200)]
basic/log: always ignore errno from the enviornment (#8841)
This extends the change done in
b29f6480ec to other logging functions.
This actually fixes some bugs in callers of log_struct(), for example
config_parse_alias() called 'return log_syntax(..., 0, ...)' which could result
in a bogus non-zero return value.
Calls to log_object() and log_format_iovec() — which is only used by
server_driver_message() — appear correct.
Lennart Poettering [Fri, 27 Apr 2018 12:28:51 +0000 (14:28 +0200)]
update TODO
Lennart Poettering [Fri, 27 Apr 2018 12:28:35 +0000 (14:28 +0200)]
tree-wide: use newa() rather than alloca() where we can
Lennart Poettering [Fri, 27 Apr 2018 12:27:14 +0000 (14:27 +0200)]
alloca: add an overflow check too
Of course, alloca() shouldn't be used with anything that can grow
without bounds anyway, but let's better safe than sorry, and catch this
early.
Since alloca() is not supposed to return an error we trigger an
assert() instead, which is still better than heap trickery.
Lennart Poettering [Fri, 27 Apr 2018 12:09:31 +0000 (14:09 +0200)]
tree-wide: be more careful with the type of array sizes
Previously we were a bit sloppy with the index and size types of arrays,
we'd regularly use unsigned. While I don't think this ever resulted in
real issues I think we should be more careful there and follow a
stricter regime: unless there's a strong reason not to use size_t for
array sizes and indexes, size_t it should be. Any allocations we do
ultimately will use size_t anyway, and converting forth and back between
unsigned and size_t will always be a source of problems.
Note that on 32bit machines "unsigned" and "size_t" are equivalent, and
on 64bit machines our arrays shouldn't grow that large anyway, and if
they do we have a problem, however that kind of overly large allocation
we have protections for usually, but for overflows we do not have that
so much, hence let's add it.
So yeah, it's a story of the current code being already "good enough",
but I think some extra type hygiene is better.
This patch tries to be comprehensive, but it probably isn't and I missed
a few cases. But I guess we can cover that later as we notice it. Among
smaller fixes, this changes:
1. strv_length()' return type becomes size_t
2. the unit file changes array size becomes size_t
3. DNS answer and query array sizes become size_t
Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=76745