summaryrefslogtreecommitdiff
path: root/hw/xfree86/os-support/linux
diff options
context:
space:
mode:
Diffstat (limited to 'hw/xfree86/os-support/linux')
-rw-r--r--hw/xfree86/os-support/linux/Makefile.am1
-rw-r--r--hw/xfree86/os-support/linux/lnx_axp.c2
-rw-r--r--hw/xfree86/os-support/linux/lnx_font.c2
-rw-r--r--hw/xfree86/os-support/linux/lnx_init.c46
4 files changed, 27 insertions, 24 deletions
diff --git a/hw/xfree86/os-support/linux/Makefile.am b/hw/xfree86/os-support/linux/Makefile.am
index 81bd055e3..1239c8f6b 100644
--- a/hw/xfree86/os-support/linux/Makefile.am
+++ b/hw/xfree86/os-support/linux/Makefile.am
@@ -32,7 +32,6 @@ liblinux_la_SOURCES = lnx_init.c lnx_video.c \
$(srcdir)/../shared/posix_tty.c \
$(srcdir)/../shared/vidmem.c \
$(srcdir)/../shared/sigio.c \
- $(srcdir)/../shared/stdResource.c \
$(ACPI_SRCS) \
$(APM_SRCS) \
$(PLATFORM_PCI_SUPPORT)
diff --git a/hw/xfree86/os-support/linux/lnx_axp.c b/hw/xfree86/os-support/linux/lnx_axp.c
index d25999924..8571c048b 100644
--- a/hw/xfree86/os-support/linux/lnx_axp.c
+++ b/hw/xfree86/os-support/linux/lnx_axp.c
@@ -49,7 +49,7 @@ static AXP axpList[] = {
{"Miata",NULL,NULL,PYXIS_CIA},
{"Ruffian",NULL,NULL,PYXIS_CIA},
{"Nautilus",NULL,NULL,IRONGATE},
- {NULL,NULL,NULL,NONE}
+ {NULL,NULL,NULL,SYS_NONE}
};
diff --git a/hw/xfree86/os-support/linux/lnx_font.c b/hw/xfree86/os-support/linux/lnx_font.c
index 5b2696af5..d6fc283c0 100644
--- a/hw/xfree86/os-support/linux/lnx_font.c
+++ b/hw/xfree86/os-support/linux/lnx_font.c
@@ -168,7 +168,7 @@ lnx_savefont(void)
return FALSE;
}
- size = (width + 7)/8 * 32 * charcount;
+ size = bits_to_bytes(width) * 32 * charcount;
fontdata = (unsigned char *)xnfalloc(size);
if (!fontdata) {
xf86Msg(X_WARNING,
diff --git a/hw/xfree86/os-support/linux/lnx_init.c b/hw/xfree86/os-support/linux/lnx_init.c
index a49086b37..5a6db8081 100644
--- a/hw/xfree86/os-support/linux/lnx_init.c
+++ b/hw/xfree86/os-support/linux/lnx_init.c
@@ -74,9 +74,11 @@ saveVtPerms(void)
static void
restoreVtPerms(void)
{
- /* Set the terminal permissions back to before we started. */
- chown("/dev/tty0", vtPermSave[0], vtPermSave[1]);
- chown(vtname, vtPermSave[2], vtPermSave[3]);
+ if (geteuid() == 0) {
+ /* Set the terminal permissions back to before we started. */
+ (void)chown("/dev/tty0", vtPermSave[0], vtPermSave[1]);
+ (void)chown(vtname, vtPermSave[2], vtPermSave[3]);
+ }
}
static void *console_handler;
@@ -184,20 +186,22 @@ xf86OpenConsole(void)
xf86Msg(X_WARNING,
"xf86OpenConsole: Could not save ownership of VT\n");
- /* change ownership of the vt */
- if (chown(vtname, getuid(), getgid()) < 0)
- xf86Msg(X_WARNING,"xf86OpenConsole: chown %s failed: %s\n",
- vtname, strerror(errno));
-
- /*
- * the current VT device we're running on is not "console", we want
- * to grab all consoles too
- *
- * Why is this needed??
- */
- if (chown("/dev/tty0", getuid(), getgid()) < 0)
- xf86Msg(X_WARNING,"xf86OpenConsole: chown /dev/tty0 failed: %s\n",
- strerror(errno));
+ if (geteuid() == 0) {
+ /* change ownership of the vt */
+ if (chown(vtname, getuid(), getgid()) < 0)
+ xf86Msg(X_WARNING,"xf86OpenConsole: chown %s failed: %s\n",
+ vtname, strerror(errno));
+
+ /*
+ * the current VT device we're running on is not
+ * "console", we want to grab all consoles too
+ *
+ * Why is this needed??
+ */
+ if (chown("/dev/tty0", getuid(), getgid()) < 0)
+ xf86Msg(X_WARNING,"xf86OpenConsole: chown /dev/tty0 failed: %s\n",
+ strerror(errno));
+ }
}
/*
@@ -282,9 +286,6 @@ xf86OpenConsole(void)
/* we really should have a InitOSInputDevices() function instead
* of Init?$#*&Device(). So I just place it here */
-
- } else { /* ShareVTs */
- close(xf86Info.consoleFd);
}
} else { /* serverGeneration != 1 */
if (!ShareVTs && VTSwitch)
@@ -313,7 +314,10 @@ xf86CloseConsole(void)
int vtno = -1;
#endif
- if (ShareVTs) return;
+ if (ShareVTs) {
+ close(xf86Info.consoleFd);
+ return;
+ }
if (console_handler) {
xf86RemoveGeneralHandler(console_handler);