core,logind,systemctl,journald: replace calls to strerror() with setting errno + %m
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Fri, 7 Oct 2022 07:15:44 +0000 (09:15 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Tue, 11 Oct 2022 14:10:21 +0000 (16:10 +0200)
commit385530342869ce4c6ea7388262bec4a0398b9311
treeb9547137bb5d84351f187465b234de5f9cde4060
parent892dc967873cab3b8af158284a524d3148db674a
core,logind,systemctl,journald: replace calls to strerror() with setting errno + %m

strerror() is not thread safe and calling it just isn't worth the effort
required to justify why it would be safe in those cases. It's easier to just
use %m which is thread-safe out of the box. I don't think that any of the
changes in the patch cause any functional difference. This is just about
getting rid of calls to strerror() in general.

When we print an error message and fail to format the string, using something
like "(null)" is good enough. This is very very unlikely to happen anyway.
src/core/cgroup.c
src/core/execute.c
src/core/selinux-access.c
src/core/socket.c
src/core/unit-serialize.c
src/journal/journald-server.c
src/systemctl/systemctl-show.c