diff options
Diffstat (limited to 'app/xdm/config/Xsession.cpp')
-rw-r--r-- | app/xdm/config/Xsession.cpp | 63 |
1 files changed, 42 insertions, 21 deletions
diff --git a/app/xdm/config/Xsession.cpp b/app/xdm/config/Xsession.cpp index b78c11e5b..060d17c18 100644 --- a/app/xdm/config/Xsession.cpp +++ b/app/xdm/config/Xsession.cpp @@ -1,23 +1,46 @@ XCOMM!SHELL_CMD XCOMM +XCOMM $XdotOrg: $ XCOMM $Xorg: Xsession,v 1.4 2000/08/17 19:54:17 cpqbld Exp $ -XCOMM $OpenBSD: Xsession.cpp,v 1.3 2007/04/04 22:29:12 david Exp $ +XCOMM $OpenBSD: Xsession.cpp,v 1.4 2007/08/05 19:37:40 matthieu Exp $ XCOMM $XFree86: xc/programs/xdm/config/Xsession,v 1.2 1998/01/11 03:48:32 dawes Exp $ XCOMM redirect errors to a file in user's home directory if we can -for errfile in "$HOME/.xsession-errors" "${TMPDIR-/tmp}/xses-$USER" "/tmp/xses-$USER" -do - case "$errfile" in - "/tmp/*" | "/var/tmp/*") - errfile=`mktemp ${errfile}.XXXXXXXXXX` || break; - ;; - esac - if ( umask 077 && cp /dev/null "$errfile" 2> /dev/null ) - then - exec > "$errfile" 2>&1 - break - fi -done + +errfile="$HOME/.xsession-errors" +if ( umask 077 && cp /dev/null "$errfile" 2> /dev/null ) +then + exec > "$errfile" 2>&1 +else +#ifdef MKTEMP_COMMAND + mktemp=MKTEMP_COMMAND + for errfile in "${TMPDIR-/tmp}/xses-$USER" "/tmp/xses-$USER" + do + if ef="$( umask 077 && $mktemp "$errfile.XXXXXX" 2> /dev/null)" + then + exec > "$ef" 2>&1 + mv "$ef" "$errfile" 2> /dev/null + break + fi + done +#else +XCOMM Since this system doesn't have a mktemp command to allow secure +XCOMM creation of files in shared directories, no fallback error log +XCOMM is being used. See https://bugs.freedesktop.org/show_bug.cgi?id=5898 +XCOMM +XCOMM for errfile in "${TMPDIR-/tmp}/xses-$USER" "/tmp/xses-$USER" +XCOMM do +XCOMM if ( umask 077 && cp /dev/null "$errfile" 2> /dev/null ) +XCOMM then +XCOMM exec > "$errfile" 2>&1 +XCOMM break +XCOMM fi +XCOMM done + + exec > /dev/null 2>&1 + +#endif +fi XCOMM if we have private ssh key(s), start ssh-agent and add the key(s) id1=$HOME/.ssh/identity @@ -41,25 +64,24 @@ case $# in 1) case $1 in failsafe) - BINDIR/xterm -geometry 80x24-0-0 - do_exit + exec BINDIR/xterm -geometry 80x24-0-0 ;; esac esac -XCOMM The startup script is not intended to have arguments. +XCOMM The startup script is not intended to have arguments. startup=$HOME/.xsession resources=$HOME/.Xresources if [ -s "$startup" ]; then if [ -x "$startup" ]; then - "$startup" + exec "$startup" else - /bin/sh "$startup" + exec /bin/sh "$startup" fi else - if [ -f "$resources" ]; then + if [ -r "$resources" ]; then BINDIR/xrdb -load "$resources" fi #if defined(__SCO__) || defined(__UNIXWARE__) @@ -83,4 +105,3 @@ else BINDIR/xterm & BINDIR/fvwm fi -do_exit |