CHROMIUM: sysdeps: Only open oom_score_adj read/write if we need to write it

If we're running in a sandbox, we might not have write access to
oom_score_adj. In the common case where we don't have any special
protection from the OOM-killer, we can detect that with only read
access, and skip the part where we open it for writing.

(We would also not have write access to oom_score_adj if we're running
with elevated Linux capabilities while not root, but that should never
actually happen for dbus-daemon-launch-helper, which is setuid root
for production use or has no capabilities during unit-testing.)

BUG=b:328177761
TEST=none

Cq-Depend: chromium:5393801
Change-Id: I20f5215951009cc97ec5f589c2f11bab2f1c1025
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/dbus/+/5395780
Tested-by: Kornel Dulęba <korneld@google.com>
Reviewed-by: Eric Caruso <ejcaruso@chromium.org>
Commit-Queue: Kornel Dulęba <korneld@google.com>
1 file changed