basic/log: do not treat all negative errnos as synthetic
authorMike Yuan <me@yhndnzj.com>
Wed, 24 Jul 2024 14:28:48 +0000 (16:28 +0200)
committerLuca Boccassi <bluca@debian.org>
Thu, 15 Aug 2024 10:07:16 +0000 (11:07 +0100)
commit4ad6b2631d73a574859a62d33715a7bdef810bcf
treefeb588a7bde3e7aaaf7d70841323b660d2e8406d
parent277204f1a3a8a9f924431929b7056a50d09b4ba0
basic/log: do not treat all negative errnos as synthetic

Currently, IS_SYNTHETIC_ERRNO() evaluates to true for all negative errnos,
because of the two's-complement negative value representation.
Subsequently, ERRNO= is not logged for most of our own code.
Let's fix this, by formatting all synthetic errnos as positive.
Then, treat all negative values as non-synthetic.

While at it, mark the evaluation order explicitly, and remove
unneeded comment.

Fixes #33800

(cherry picked from commit 268f58076f7e0258dce75f521d08199092279853)
src/basic/log.h
src/test/test-log.c