1581N/A--- a/hw/xfree86/os-support/solaris/sun_vid.c Fri Jun 5 08:19:40 2015
1581N/A+++ b/hw/xfree86/os-support/solaris/sun_vid.c Thu Nov 12 14:44:00 2015
1581N/A@@ -22,7 +22,7 @@
1581N/A * OF THIS SOFTWARE.
1581N/A *
1581N/A */
1581N/A-/* Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved.
1584N/A+/* Copyright (c) 2008, 2015, Oracle and/or its affiliates. All rights reserved.
1581N/A *
1581N/A * Permission is hereby granted, free of charge, to any person obtaining a
1581N/A * copy of this software and associated documentation files (the "Software"),
1581N/A@@ -81,14 +81,27 @@
1581N/A xf86EnableIO(void)
1581N/A {
1581N/A #if defined(__i386__) || defined(__i386) || defined(__x86)
1581N/A+ uid_t user_id;
1581N/A if (ExtendedEnabled)
1581N/A return TRUE;
1581N/A+ user_id = geteuid();
1581N/A+ if (user_id != 0) { /* reset privs back to root */
1584N/A+ if (seteuid(0) < 0) {
1584N/A+ xf86Msg(X_WARNING, "Error in resetting euid to root \n");
1584N/A+ }
1581N/A+ }
1581N/A
1581N/A if (sysi86(SI86V86, V86SC_IOPL, PS_IOPL) < 0) {
1581N/A xf86Msg(X_WARNING, "xf86EnableIOPorts: Failed to set IOPL for I/O\n");
1581N/A return FALSE;
1581N/A }
1581N/A- ExtendedEnabled = TRUE;
1581N/A+ else
1581N/A+ ExtendedEnabled = TRUE;
1581N/A+ if (user_id != 0) { /* reset privs back to user */
1581N/A+ if (seteuid(user_id) < 0) {
1584N/A+ xf86Msg(X_WARNING, "Error in resetting euid to %d\n", user_id);
1581N/A+ }
1581N/A+ }
1581N/A #endif /* i386 */
1581N/A return TRUE;
1581N/A }
1581N/A@@ -100,8 +113,9 @@
1581N/A if (!ExtendedEnabled)
1581N/A return;
1581N/A
1581N/A- sysi86(SI86V86, V86SC_IOPL, 0);
1581N/A-
1581N/A- ExtendedEnabled = FALSE;
1584N/A+ if (sysi86(SI86V86, V86SC_IOPL, 0) < 0)
1581N/A+ xf86Msg(X_WARNING, "xf86DisableIOPorts: Failed to set IOPL for I/O\n");
1581N/A+ else
1581N/A+ ExtendedEnabled = FALSE;
1581N/A #endif /* i386 */
1581N/A }