Commit 4f54a212 authored by nerdopolis's avatar nerdopolis Committed by n3rdopolis
Browse files

xfree86: On Linux, while only seat0 can have TTYs, don't assmume all seat0s have TTYs

parent ca1dfdc9
Pipeline #423578 passed with stages
in 5 minutes and 27 seconds
......@@ -85,6 +85,11 @@
#include <X11/extensions/dpmsconst.h>
#include "dpmsproc.h"
#endif
#ifdef __linux__
#include <linux/major.h>
#include <sys/sysmacros.h>
#endif
#include <hotplug.h>
void (*xf86OSPMClose) (void) = NULL;
......@@ -201,6 +206,17 @@ xf86PrivsElevated(void)
return PrivsElevated();
}
Bool
xf86HasTTYs(void)
{
#ifdef __linux__
struct stat tty0devAttributes;
return (stat("/dev/tty0", &tty0devAttributes) == 0 && major(tty0devAttributes.st_rdev) == TTY_MAJOR);
#else
return TRUE;
#endif
}
static void
xf86AutoConfigOutputDevices(void)
{
......@@ -425,7 +441,7 @@ InitOutput(ScreenInfo * pScreenInfo, int argc, char **argv)
want_hw_access = TRUE;
/* Non-seat0 X servers should not open console */
if (!(flags & HW_SKIP_CONSOLE) && !ServerIsNotSeat0())
if (!(flags & HW_SKIP_CONSOLE) && !ServerIsNotSeat0() && xf86HasTTYs())
xorgHWOpenConsole = TRUE;
}
......
......@@ -158,6 +158,8 @@ extern _X_EXPORT Bool
xf86CallDriverProbe(struct _DriverRec *drv, Bool detect_only);
extern _X_EXPORT Bool
xf86PrivsElevated(void);
extern _X_EXPORT Bool
xf86HasTTYs(void);
#endif /* _NO_XF86_PROTOTYPES */
......
......@@ -38,6 +38,7 @@
#include "xf86.h"
#include "xf86platformBus.h"
#include "xf86Xinput.h"
#include "xf86Priv.h"
#include "globals.h"
#include "systemd-logind.h"
......@@ -583,7 +584,7 @@ static struct dbus_core_hook core_hook = {
int
systemd_logind_init(void)
{
if (!ServerIsNotSeat0() && linux_parse_vt_settings(TRUE) && !linux_get_keeptty()) {
if (!ServerIsNotSeat0() && xf86HasTTYs() && linux_parse_vt_settings(TRUE) && !linux_get_keeptty()) {
LogMessage(X_INFO,
"systemd-logind: logind integration requires -keeptty and "
"-keeptty was not provided, disabling logind integration\n");
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment