summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/dm.h1
-rw-r--r--xenodm/dm.c40
-rw-r--r--xenodm/dpylist.c2
3 files changed, 43 insertions, 0 deletions
diff --git a/include/dm.h b/include/dm.h
index 76de42e..ab67e33 100644
--- a/include/dm.h
+++ b/include/dm.h
@@ -135,6 +135,7 @@ struct display {
Display *dpy; /* Display */
char *windowPath; /* path to server "window" */
+ char *consolePath; /* path to the console device */
/* autologin */
char *autoLogin; /* user to auto-login */
diff --git a/xenodm/dm.c b/xenodm/dm.c
index 1b0353f..a524d65 100644
--- a/xenodm/dm.c
+++ b/xenodm/dm.c
@@ -37,6 +37,7 @@ from The Open Group.
#include "dm_auth.h"
#include "dm_error.h"
+#include <paths.h>
#include <stdio.h>
#include <signal.h>
@@ -492,6 +493,44 @@ StartDisplays (void)
}
static void
+SetConsolePath(struct display *d)
+{
+ Atom prop;
+ Atom actualtype;
+ int actualformat;
+ unsigned long nitems;
+ unsigned long bytes_after;
+ unsigned char *buf;
+
+ prop = XInternAtom(d->dpy, "Xorg_Console", False);
+ if (prop == None) {
+ LogError("no Xorg_Console atom\n");
+ return;
+ }
+ if (XGetWindowProperty(d->dpy, DefaultRootWindow(d->dpy), prop, 0,
+ TTY_NAME_MAX << 2,
+ False, AnyPropertyType, &actualtype, &actualformat,
+ &nitems, &bytes_after, &buf)) {
+ LogError("no Xorg_Console property\n");
+ return;
+ }
+ if (actualtype != XA_STRING) {
+ LogError("type %lx in Xorg_Console property!\n", actualtype);
+ XFree(buf);
+ return;
+ }
+ if (actualformat != 8) {
+ LogError("format %d in Xorg_Console property!\n", actualformat);
+ XFree(buf);
+ return;
+ }
+ d->consolePath = strdup(buf + strlen(_PATH_DEV));
+ LogInfo("consolePath: %s\n", d->consolePath);
+ XFree(buf);
+}
+
+
+static void
SetWindowPath(struct display *d)
{
/* setting WINDOWPATH for clients */
@@ -595,6 +634,7 @@ StartDisplay (struct display *d)
SetAuthorization (d);
if (!WaitForServer (d))
exit (OPENFAILED_DISPLAY);
+ SetConsolePath(d);
SetWindowPath(d);
if (pledge("stdio rpath cpath wpath fattr flock proc dns inet unix exec prot_exec getpw id", NULL) != 0)
exit(OPENFAILED_DISPLAY);
diff --git a/xenodm/dpylist.c b/xenodm/dpylist.c
index 32adbfa..f70086b 100644
--- a/xenodm/dpylist.c
+++ b/xenodm/dpylist.c
@@ -134,6 +134,7 @@ RemoveDisplay (struct display *old)
free (d->authNames);
free (d->authNameLens);
free (d->windowPath);
+ free (d->consolePath);
free (d);
break;
}
@@ -210,6 +211,7 @@ NewDisplay (char *name, char *class)
d->grabTimeout = 0;
d->dpy = NULL;
d->windowPath = NULL;
+ d->consolePath = NULL;
displays = d;
return d;
}