[PATCH 1/2] Properly register session with utmp

Matěj Cepl mcepl at redhat.com
Tue Aug 9 06:34:52 PDT 2011


Fixing https://bugzilla.redhat.com/177890
Patch by Wilfried Teiken (wteikens at @teiken dot org)

The patch doesn't hardcode sessreg’s filename.

Concerning using sed instead of cpp, it is both too bother for
this, cpp(1) claims it shouldn’t be used for non-C-like code, and
mostly it truly eliminates my comments.

Signed-off-by: Matěj Cepl <mcepl at redhat.com>
---
 config/GiveConsole     |    9 ---------
 config/GiveConsole.cpp |   11 +++++++++++
 config/Makefile.am     |    5 +++--
 config/Xstartup.cpp    |    3 +--
 4 files changed, 15 insertions(+), 13 deletions(-)
 delete mode 100644 config/GiveConsole
 create mode 100644 config/GiveConsole.cpp

diff --git a/config/GiveConsole b/config/GiveConsole
deleted file mode 100644
index f8a8c6d..0000000
--- a/config/GiveConsole
+++ /dev/null
@@ -1,9 +0,0 @@
-#!/bin/sh
-# Assign ownership of the console to the invoking user
-#
-# By convention, both xconsole and xterm -C check that the
-# console is owned by the invoking user and is readable before attaching
-# the console output.  This way a random user can invoke xterm -C without
-# causing serious grief.
-#
-chown $USER /dev/console
diff --git a/config/GiveConsole.cpp b/config/GiveConsole.cpp
new file mode 100644
index 0000000..850757e
--- /dev/null
+++ b/config/GiveConsole.cpp
@@ -0,0 +1,11 @@
+XCOMM!/bin/sh
+XCOMM Assign ownership of the console to the invoking user
+XCOMM
+XCOMM By convention, both xconsole and xterm -C check that the
+XCOMM console is owned by the invoking user and is readable before attaching
+XCOMM the console output.  This way a random user can invoke xterm -C without
+XCOMM causing serious grief.
+XCOMM
+chown $USER /dev/console
+exec BINDIR/sessreg -a -x "/etc/X11/xdm/Xservers" \
+    -l $DISPLAY -h "" $USER
diff --git a/config/Makefile.am b/config/Makefile.am
index 30e22ea..31b53b3 100644
--- a/config/Makefile.am
+++ b/config/Makefile.am
@@ -28,11 +28,12 @@ pixmapdir = $(XDM_PIXMAPDIR)
 
 dist_pixmap_DATA = xorg-bw.xpm xorg.xpm
 
-BUILT_SOURCES = Xservers.ws xdm-config Xreset Xresources Xsession Xstartup
+BUILT_SOURCES = Xservers.ws xdm-config Xreset Xresources Xsession \
+		Xstartup GiveConsole
 
 CLEANFILES = $(BUILT_SOURCES) Xservers
 
-EXTRA_DIST = Xservers.ws.cpp Xservers.fs \
+EXTRA_DIST = Xservers.ws.cpp Xservers.fs GiveConsole.cpp \
 	xdm-config.cpp Xreset.cpp Xresources.cpp Xsession.cpp Xstartup.cpp
 
 Xservers: Xservers.$(SERVERSTYPE)
diff --git a/config/Xstartup.cpp b/config/Xstartup.cpp
index 001cef2..1207bd3 100644
--- a/config/Xstartup.cpp
+++ b/config/Xstartup.cpp
@@ -1,5 +1,4 @@
 XCOMM!/bin/sh
 XCOMM Register a login (derived from GiveConsole as follows:)
 XCOMM
-exec BINDIR/sessreg  -a -w WTMP_FILE -u UTMP_FILE \
-	-x XDMCONFIGDIR/Xservers -l $DISPLAY -h "" $USER
+exec BINDIR/sessreg  -a -x XDMCONFIGDIR/Xservers -l $DISPLAY -h "" $USER
-- 
1.7.6



More information about the xorg-devel mailing list