chiark / gitweb /
logind: introduce an explicit session class for cronjobs and similar
[elogind.git] / src / login / logind-session.c
index b64a5d302d3b33338e27a3f504124310a2c10972..508336d4d3b6fbc756917f8f804a0965f2e187a8 100644 (file)
@@ -33,6 +33,7 @@
 #include "path-util.h"
 #include "cgroup-util.h"
 #include "logind-session.h"
+#include "fileio.h"
 
 Session* session_new(Manager *m, User *u, const char *id) {
         Session *s;
@@ -772,7 +773,6 @@ static int get_process_ctty_atime(pid_t pid, usec_t *atime) {
 }
 
 int session_get_idle_hint(Session *s, dual_timestamp *t) {
-        _cleanup_free_ char *p = NULL;
         usec_t atime = 0, n;
         int r;
 
@@ -786,7 +786,7 @@ int session_get_idle_hint(Session *s, dual_timestamp *t) {
                 return s->idle_hint;
         }
 
-        /* Graphical sessions really should really implement a real
+        /* Graphical sessions should really implement a real
          * idle hint logic */
         if (s->display)
                 goto dont_know;
@@ -898,7 +898,7 @@ int session_create_fifo(Session *s) {
 
         /* Open reading side */
         if (s->fifo_fd < 0) {
-                struct epoll_event ev;
+                struct epoll_event ev = {};
 
                 s->fifo_fd = open(s->fifo_path, O_RDONLY|O_CLOEXEC|O_NDELAY);
                 if (s->fifo_fd < 0)
@@ -908,7 +908,6 @@ int session_create_fifo(Session *s) {
                 if (r < 0)
                         return r;
 
-                zero(ev);
                 ev.events = 0;
                 ev.data.u32 = FD_OTHER_BASE + s->fifo_fd;
 
@@ -1057,7 +1056,8 @@ DEFINE_STRING_TABLE_LOOKUP(session_type, SessionType);
 static const char* const session_class_table[_SESSION_CLASS_MAX] = {
         [SESSION_USER] = "user",
         [SESSION_GREETER] = "greeter",
-        [SESSION_LOCK_SCREEN] = "lock-screen"
+        [SESSION_LOCK_SCREEN] = "lock-screen",
+        [SESSION_BACKGROUND] = "background"
 };
 
 DEFINE_STRING_TABLE_LOOKUP(session_class, SessionClass);