1
0
mirror of https://github.com/systemd/systemd.git synced 2025-01-04 09:18:12 +03:00

varlink: invert uid check to reduce call of getuid()

This commit is contained in:
Yu Watanabe 2024-12-22 01:34:04 +09:00
parent 7647b8b2c2
commit 275f747924

View File

@ -72,7 +72,7 @@ int varlink_method_set_log_level(sd_varlink *link, sd_json_variant *parameters,
if (r < 0)
return r;
if (uid != getuid() && uid != 0)
if (uid != 0 && uid != getuid())
return sd_varlink_error(link, SD_VARLINK_ERROR_PERMISSION_DENIED, parameters);
log_debug("Received io.systemd.Service.SetLogLevel(%i)", level);