]> git.ipfire.org Git - thirdparty/systemd.git/commit
journal: avoid code that relies on LOG_KERN == 0 (#8110)
authorAlan Jenkins <alan.christopher.jenkins@gmail.com>
Thu, 8 Feb 2018 08:14:32 +0000 (08:14 +0000)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Thu, 8 Feb 2018 08:14:32 +0000 (09:14 +0100)
commitb36003461a11d79d22bb48b7efe2c836fd762fc1
tree7cfa2b6c620fae816c30c844f42f522127d928b9
parent3b8f29fd93899c4876a6ef53f9bcb6b40e1c98e7
journal: avoid code that relies on LOG_KERN == 0 (#8110)

LOG_FAC() is the general way to extract the logging facility (when it has
been combined with the logging priority).

LOG_FACMASK can be used to mask off the priority so you only have the
logging facility bits... but to get the logging facility e.g. LOG_USER,
you also have to bitshift it as well.  (The priority is in the low bits,
and so only requires masking).

((priority & LOG_FACMASK) == LOG_KERN) happens to work only because
LOG_KERN is 0, and hence has the same value with or without the bitshift.

Code that relies on weird assumptions like this could make it harder to
realize how the logging values are treated.
src/journal/journald-kmsg.c