summaryrefslogtreecommitdiff
path: root/src/login/logind-session.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2012-04-16 16:47:33 +0200
committerLennart Poettering <lennart@poettering.net>2012-04-16 18:59:08 +0200
commitf8e2fb7b14e53f5a4bcfd66d26910af1dee185c6 (patch)
treec8f7ab02b4525466984a7fa23ebedfde090ef168 /src/login/logind-session.c
parent9156e799a258658cf3f51434708cdb194c13eaa4 (diff)
logind: add shutdown/suspend/idle inhibition framework
Diffstat (limited to 'src/login/logind-session.c')
-rw-r--r--src/login/logind-session.c21
1 files changed, 7 insertions, 14 deletions
diff --git a/src/login/logind-session.c b/src/login/logind-session.c
index cbc4b5cf3c..5490366cc1 100644
--- a/src/login/logind-session.c
+++ b/src/login/logind-session.c
@@ -25,11 +25,11 @@
#include <sys/epoll.h>
#include <fcntl.h>
-#include "logind-session.h"
#include "strv.h"
#include "util.h"
#include "mkdir.h"
#include "cgroup-util.h"
+#include "logind-session.h"
#define IDLE_THRESHOLD_USEC (5*USEC_PER_MINUTE)
@@ -52,7 +52,7 @@ Session* session_new(Manager *m, User *u, const char *id) {
s->id = file_name_from_path(s->state_file);
if (hashmap_put(m->sessions, s->id, s) < 0) {
- free(s->id);
+ free(s->state_file);
free(s);
return NULL;
}
@@ -99,7 +99,6 @@ void session_free(Session *s) {
free(s->service);
hashmap_remove(s->manager->sessions, s->id);
-
session_remove_fifo(s);
free(s->state_file);
@@ -287,14 +286,9 @@ int session_load(Session *s) {
}
if (leader) {
- pid_t pid;
-
- k = parse_pid(leader, &pid);
- if (k >= 0 && pid >= 1) {
- s->leader = pid;
-
- audit_session_from_pid(pid, &s->audit_id);
- }
+ k = parse_pid(leader, &s->leader);
+ if (k >= 0)
+ audit_session_from_pid(s->leader, &s->audit_id);
}
if (type) {
@@ -326,7 +320,6 @@ int session_load(Session *s) {
close_nointr_nofail(fd);
}
-
finish:
free(remote);
free(kill_processes);
@@ -840,7 +833,7 @@ int session_create_fifo(Session *s) {
if (s->fifo_fd < 0)
return -errno;
- r = hashmap_put(s->manager->fifo_fds, INT_TO_PTR(s->fifo_fd + 1), s);
+ r = hashmap_put(s->manager->session_fds, INT_TO_PTR(s->fifo_fd + 1), s);
if (r < 0)
return r;
@@ -864,7 +857,7 @@ void session_remove_fifo(Session *s) {
assert(s);
if (s->fifo_fd >= 0) {
- assert_se(hashmap_remove(s->manager->fifo_fds, INT_TO_PTR(s->fifo_fd + 1)) == s);
+ assert_se(hashmap_remove(s->manager->session_fds, INT_TO_PTR(s->fifo_fd + 1)) == s);
assert_se(epoll_ctl(s->manager->epoll_fd, EPOLL_CTL_DEL, s->fifo_fd, NULL) == 0);
close_nointr_nofail(s->fifo_fd);
s->fifo_fd = -1;