[systemd-devel] [PATCH v2 08/10] logind: fix session_activate(vtnr = 0)

David Herrmann dh.herrmann at gmail.com
Tue Sep 17 08:40:01 PDT 2013


VT numbers start with 1. If a session has vtnr == 0, we must not assume it
is running on a VT.
Note that this could trigger the assert() below as CreateSession() sets
vtnr to 0, not <0.
---
 src/login/logind-session.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/login/logind-session.c b/src/login/logind-session.c
index 77eeb9c..1df2a06 100644
--- a/src/login/logind-session.c
+++ b/src/login/logind-session.c
@@ -378,7 +378,7 @@ int session_activate(Session *s) {
         assert(s);
         assert(s->user);
 
-        if (s->vtnr < 0)
+        if (s->vtnr <= 0)
                 return -ENOTSUP;
 
         if (!s->seat)
-- 
1.8.4



More information about the systemd-devel mailing list