]> git.ipfire.org Git - thirdparty/systemd.git/commit
basic/log: log any available location information in log_syntax()
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Wed, 3 Apr 2019 07:13:37 +0000 (09:13 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Wed, 3 Apr 2019 07:13:37 +0000 (09:13 +0200)
commit6bfb1daff14344b74c034238980390190d4faa69
tree0425f4b5d170aa97875789ef1669fda9bba97f65
parente7ccdfa8099711b76e63bba7ccb3d3ddafb30361
basic/log: log any available location information in log_syntax()

We would log "(null):0: Failed to parse system call, ignoring: rseq" from
log_syntax_internal() from log_syntax() from seccomp_parse_syscall_filter_full()
from seccomp_parse_syscall_filter() from config_parse_syscall_filter(),
when generating the built-in @default whitelist. Since it was not based on the
unit file, we would not pass a file name.

So let's make sure that log_syntax() does not print "(null)" pointer (which is
iffy and ugly), and use the unit name as fallback or nothing if both are missing.
In principle, one of the two should be always available, since why use log_syntax()
otherwise, but let's make things more resilient by guarding against this case too.
log_syntax() is called from a thousand places, and often in error path, so it's
hard to verify all callers.
src/basic/log.c