summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/login/logind-dbus.c4
-rw-r--r--src/login/logind-session.c18
-rw-r--r--src/login/logind-session.h2
3 files changed, 14 insertions, 10 deletions
diff --git a/src/login/logind-dbus.c b/src/login/logind-dbus.c
index b28d280939..a3d49efbdd 100644
--- a/src/login/logind-dbus.c
+++ b/src/login/logind-dbus.c
@@ -827,7 +827,9 @@ static int method_release_session(sd_bus *bus, sd_bus_message *message, void *us
if (r < 0)
return r;
- session_release(session);
+ r = session_release(session);
+ if (r < 0)
+ return r;
return sd_bus_reply_method_return(message, NULL);
}
diff --git a/src/login/logind-session.c b/src/login/logind-session.c
index 8d33579a01..59f765782a 100644
--- a/src/login/logind-session.c
+++ b/src/login/logind-session.c
@@ -701,18 +701,20 @@ static int release_timeout_callback(sd_event_source *es, uint64_t usec, void *us
return 0;
}
-void session_release(Session *s) {
+int session_release(Session *s) {
assert(s);
if (!s->started || s->stopping)
- return;
+ return 0;
+
+ if (s->timer_event_source)
+ return 0;
- if (!s->timer_event_source)
- sd_event_add_time(s->manager->event,
- &s->timer_event_source,
- CLOCK_MONOTONIC,
- now(CLOCK_MONOTONIC) + RELEASE_USEC, 0,
- release_timeout_callback, s);
+ return sd_event_add_time(s->manager->event,
+ &s->timer_event_source,
+ CLOCK_MONOTONIC,
+ now(CLOCK_MONOTONIC) + RELEASE_USEC, 0,
+ release_timeout_callback, s);
}
bool session_is_active(Session *s) {
diff --git a/src/login/logind-session.h b/src/login/logind-session.h
index 0505f7f0bd..9305dca83f 100644
--- a/src/login/logind-session.h
+++ b/src/login/logind-session.h
@@ -137,7 +137,7 @@ int session_create_fifo(Session *s);
int session_start(Session *s);
int session_stop(Session *s, bool force);
int session_finalize(Session *s);
-void session_release(Session *s);
+int session_release(Session *s);
int session_save(Session *s);
int session_load(Session *s);
int session_kill(Session *s, KillWho who, int signo);