1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2025-01-11 05:17:44 +03:00

logind: fix operation precedence mix-up

Since + has higher precedence than ?:, and u+b is unlikely to be exactly zero,
the timestamp would usually be set to IDLE_THRESHOLD_USEC. Fix it by
returning either 'last activity', or 'last activity+IDLE_THRESHOLD_USEC'.
This commit is contained in:
Zbigniew Jędrzejewski-Szmek 2012-07-22 15:24:25 +02:00
parent 335c8d5ac1
commit 17804d7f0a

View File

@ -769,7 +769,7 @@ int session_get_idle_hint(Session *s, dual_timestamp *t) {
b = u + IDLE_THRESHOLD_USEC < n;
if (t)
dual_timestamp_from_realtime(t, u + b ? IDLE_THRESHOLD_USEC : 0);
dual_timestamp_from_realtime(t, u + b*IDLE_THRESHOLD_USEC);
return b;