summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2012-07-22 15:24:25 +0200
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2012-07-22 23:53:48 +0200
commit17804d7f0a4002d4f0b8f1dc6e25fcca9381c13e (patch)
treee4a3a6624937a96e58d55c8a15d59d812f444d35
parent335c8d5ac1b96c9b2a71e0f9b46a4446aded7396 (diff)
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'.
-rw-r--r--src/login/logind-session.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/login/logind-session.c b/src/login/logind-session.c
index e438c66332..819596ddbe 100644
--- a/src/login/logind-session.c
+++ b/src/login/logind-session.c
@@ -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;