1124N/Adiff --git a/dix/main.c b/dix/main.c
1351N/Aindex 0eaa6aa..f466c25 100644
1124N/A--- a/dix/main.c
1124N/A+++ b/dix/main.c
1276N/A@@ -78,6 +78,8 @@ Equipment Corporation.
851N/A #include <version-config.h>
766N/A #endif
766N/A
766N/A+#include <sys/stat.h>
766N/A+#include <stdio.h>
766N/A #include <X11/X.h>
1276N/A #include <X11/Xos.h> /* for unistd.h */
766N/A #include <X11/Xproto.h>
1351N/A@@ -123,6 +125,30 @@ extern void DtloginCloseDown(void);
851N/A
1124N/A extern void Dispatch(void);
766N/A
766N/A+#if defined(sun)
766N/A+extern const char * GetAuthFilename(void);
766N/A+
766N/A+#define LOCK_PREFIX "/var/xauth/"
766N/A+
766N/A+/*
766N/A+ * Setup /var/xauth/$DISPLAY, which is a symlink to the
766N/A+ * actually auth file.
766N/A+ */
766N/A+static void
766N/A+SetupXauthFile(char *filename)
766N/A+{
1276N/A+ struct stat buf;
1276N/A+ char sym_authfile[40];
766N/A+
1276N/A+ snprintf(sym_authfile, 40, LOCK_PREFIX "%s", display);
766N/A+
1276N/A+ mkdir(LOCK_PREFIX, S_IRWXU);
766N/A+
1276N/A+ remove(sym_authfile);
1276N/A+ symlink(filename, sym_authfile);
766N/A+}
766N/A+#endif
766N/A+
766N/A #ifdef XQUARTZ
766N/A #include <pthread.h>
766N/A
1351N/A@@ -141,6 +167,9 @@ main(int argc, char *argv[], char *envp[])
766N/A {
1276N/A int i;
1276N/A HWEventQueueType alwaysCheckForInput[2];
766N/A+#if defined(sun)
766N/A+ char *xauthfile = NULL;
766N/A+#endif
766N/A
766N/A display = "0";
766N/A
1351N/A@@ -154,6 +183,12 @@ main(int argc, char *argv[], char *envp[])
766N/A
766N/A ProcessCommandLine(argc, argv);
766N/A
766N/A+#if defined(sun)
766N/A+ xauthfile = GetAuthFilename();
766N/A+ if (xauthfile)
1276N/A+ SetupXauthFile(xauthfile);
766N/A+#endif
766N/A+
766N/A alwaysCheckForInput[0] = 0;
766N/A alwaysCheckForInput[1] = 1;
1276N/A while (1) {
1124N/Adiff --git a/hw/xfree86/os-support/solaris/sun_init.c b/hw/xfree86/os-support/solaris/sun_init.c
1276N/Aindex 4b75a98..3113186 100644
1124N/A--- a/hw/xfree86/os-support/solaris/sun_init.c
1124N/A+++ b/hw/xfree86/os-support/solaris/sun_init.c
1088N/A@@ -45,6 +45,9 @@
1088N/A #define CONSOLE_VTNO 1
1088N/A #define SOL_CONSOLE_DEV "/dev/console"
766N/A
766N/A+/* For use of VT_SETDISPLOGIN in dtlogin.c */
766N/A+extern int xf86ConsoleFd;
766N/A+
766N/A static Bool KeepTty = FALSE;
766N/A static Bool Protect0 = FALSE;
1088N/A static Bool UseConsole = FALSE;
1276N/A@@ -240,6 +243,8 @@ xf86OpenConsole(void)
851N/A
1276N/A if (ioctl(xf86Info.consoleFd, VT_SETDISPINFO, atoi(display)) < 0)
1276N/A xf86Msg(X_WARNING, "xf86OpenConsole: VT_SETDISPINFO failed\n");
778N/A+
1276N/A+ xf86ConsoleFd = xf86Info.consoleFd;
1276N/A }
766N/A #endif
766N/A