[Glibc-bsd-commits] r1906 - trunk/web/patches/debian-only
Guillem Jover
guillem at alioth.debian.org
Mon Mar 5 06:39:14 CET 2007
Author: guillem
Date: 2007-03-05 05:39:14 +0000 (Mon, 05 Mar 2007)
New Revision: 1906
Added:
trunk/web/patches/debian-only/xorg.patch
Log:
Add patch to support starting X from the console.
Added: trunk/web/patches/debian-only/xorg.patch
===================================================================
--- trunk/web/patches/debian-only/xorg.patch 2007-03-04 20:58:29 UTC (rev 1905)
+++ trunk/web/patches/debian-only/xorg.patch 2007-03-05 05:39:14 UTC (rev 1906)
@@ -0,0 +1,77 @@
+Author: guillem
+Status: in BTS
+
+diff -Nru xorg-7.1.0/debian/local/xserver-wrapper.c xorg-7.1.0/debian/local/xserver-wrapper.c
+--- xorg-7.1.0/debian/local/xserver-wrapper.c 2007-02-13 12:02:09.000000000 +0200
++++ xorg-7.1.0/debian/local/xserver-wrapper.c 2007-03-05 07:05:32.000000000 +0200
+@@ -102,7 +102,12 @@
+ # include <sys/resource.h>
+ #endif
+
++#if defined(__linux__)
+ #define VT_MAJOR_DEV 4
++#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
++#include <sys/consio.h>
++#endif
++
+ #define X_WRAPPER_CONFIG_FILE "/etc/X11/Xwrapper.config"
+ #define X_SERVER_SYMLINK_DIR "/etc/X11"
+ #define X_SERVER_SYMLINK "/etc/X11/X"
+@@ -138,10 +143,37 @@
+ }
+
+ static int
+-checkSecLevel(SecurityLevel level)
++onConsole()
+ {
++#if defined(__linux__)
+ struct stat s;
+
++ /* see if stdin is a virtual console device */
++ if (fstat(0, &s) != 0) {
++ (void) fprintf(stderr, "X: cannot stat stdin\n");
++ return FALSE;
++ }
++ if (S_ISCHR(s.st_mode) &&
++ ((s.st_rdev >> 8) & 0xff) == VT_MAJOR_DEV &&
++ (s.st_rdev & 0xff) < 64) {
++ return TRUE;
++ }
++#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
++ int idx;
++
++ if (ioctl(0, VT_GETINDEX, &idx) != -1)
++ return TRUE;
++#else
++#warning This program needs porting to your kernel.
++ (void) fprintf(stderr, "X: unable to determine if running on a console\n");
++#endif
++
++ return FALSE;
++}
++
++static int
++checkSecLevel(SecurityLevel level)
++{
+ switch (level) {
+ case RootOnly:
+ if (getuid() == 0) { /* real uid is root */
+@@ -152,16 +184,7 @@
+ break;
+ case Console:
+ if (getuid() == 0) return TRUE; /* root */
+- /* see if stdin is a virtual console device */
+- if (fstat(0, &s) != 0) {
+- (void) fprintf(stderr,"X: cannot stat stdin\n");
+- return FALSE;
+- }
+- if (S_ISCHR(s.st_mode) &&
+- ((s.st_rdev >> 8) & 0xff) == VT_MAJOR_DEV &&
+- (s.st_rdev & 0xff) < 64) {
+- return TRUE;
+- }
++ if (onConsole()) return TRUE;
+ break;
+ case Anybody:
+ return TRUE;
+
More information about the Glibc-bsd-commits
mailing list