View | Details | Raw Unified | Return to bug 5696
Collapse All | Expand All

(-)tlmisc/xstartup/xstartup.default (-3 / +13 lines)
Lines 4-17 Link Here
4
# Copyright 2002-2016 Cendio AB.
4
# Copyright 2002-2016 Cendio AB.
5
# For more information, see http://www.cendio.com
5
# For more information, see http://www.cendio.com
6
6
7
# Ignore SIGHUP, in case Xserver/xinit terminates
7
# Propagate TERM signal to tl-run-profile if available
8
trap "" SIGHUP
8
function on_term {
9
    if [ -n "$pid" ]; then
10
	kill -TERM $pid
11
    else
12
	exit
13
    fi
14
}
9
15
16
trap on_term SIGTERM
17
10
# Run all scripts in xstartup.d
18
# Run all scripts in xstartup.d
11
source "${TLPREFIX}/libexec/tl-run-xstartup.d"
19
source "${TLPREFIX}/libexec/tl-run-xstartup.d"
12
20
13
# Start the profile
21
# Start the profile
14
"${TLPREFIX}/libexec/tl-run-profile"
22
"${TLPREFIX}/libexec/tl-run-profile" &
23
pid=$!
24
wait $pid
15
echo "Profile command exited with exit code $?" >&2
25
echo "Profile command exited with exit code $?" >&2
16
26
17
# Run all scripts in xlogout.d
27
# Run all scripts in xlogout.d
(-)vsm/tl-xinit.c (-22 / +36 lines)
Lines 59-64 Link Here
59
#define PROGNAME "tl-xinit"
59
#define PROGNAME "tl-xinit"
60
#define XAUTH_TIMEOUT 15
60
#define XAUTH_TIMEOUT 15
61
#define XSERVER_KILL_TIMEOUT 10
61
#define XSERVER_KILL_TIMEOUT 10
62
#define XCLIENT_KILL_TIMEOUT XSERVER_KILL_TIMEOUT
62
#define SSO_HELPER_TIMEOUT 10
63
#define SSO_HELPER_TIMEOUT 10
63
#define TLCONFIG_TIMEOUT 10
64
#define TLCONFIG_TIMEOUT 10
64
65
Lines 67-73 Link Here
67
static volatile short got_signal = 0;
68
static volatile short got_signal = 0;
68
69
69
70
70
/* Wait for process to exit. Returns 0 if process exited, -1 if still
71
/* Wait for process to exit. Returns 0 if process exited or if pid does not exists, -1 if still
71
   around */
72
   around */
72
static int
73
static int
73
wait_for_exit(pid_t pid, int timeout)
74
wait_for_exit(pid_t pid, int timeout)
Lines 78-83 Link Here
78
    for (int i = 0; i <= timeout; i++) {
79
    for (int i = 0; i <= timeout; i++) {
79
        gotpid = waitpid(pid, &status, WNOHANG);
80
        gotpid = waitpid(pid, &status, WNOHANG);
80
        if (gotpid < 0) {
81
        if (gotpid < 0) {
82
	    if (errno == ECHILD) {
83
		return 0;
84
	    }
81
            perror(PROGNAME ": waitpid");
85
            perror(PROGNAME ": waitpid");
82
            return -1;
86
            return -1;
83
        }
87
        }
Lines 726-756 Link Here
726
    /* xinit calls XCloseDisplay, but this call will hang, say, if
730
    /* xinit calls XCloseDisplay, but this call will hang, say, if
727
       Xvnc is STOPped. Avoid that. */
731
       Xvnc is STOPped. Avoid that. */
728
732
729
    if (client > 0) {
733
    /* Send TERM to client and server processes */
730
        /* Send HUP to process group */
734
    if (kill(client, SIGTERM) < 0) {
731
        if (killpg(client, SIGHUP) < 0 && errno != ESRCH) {
735
	if (errno != ESRCH)
732
            perror(PROGNAME ": Cannot send HUP to client process group");
736
	    perror(PROGNAME ": Cannot terminate X client");
733
        }
734
    }
737
    }
735
738
736
    if (xserver > 0) {
739
    if (killpg(server, SIGTERM) < 0) {
737
        if (killpg(xserver, SIGTERM) < 0) {
740
	if (errno != ESRCH)
738
            if (errno == ESRCH) {
741
	    perror(PROGNAME ": Cannot terminate X server");
739
                return;
742
    }
740
            }
743
741
            perror(PROGNAME ": Cannot terminate X server");
744
    /* Wait for server termination */
745
    if (wait_for_exit(xserver, XSERVER_KILL_TIMEOUT) < 0) {
746
	fprintf(stderr,
747
		PROGNAME ": Xserver is slow to shutdown, forcing\n");
748
749
	if (killpg(xserver, SIGKILL) < 0) {
750
            if (errno != ESRCH) {
751
		perror(PROGNAME ": X server refuses to terminate");
752
	    }
742
        }
753
        }
743
        if (wait_for_exit(xserver, XSERVER_KILL_TIMEOUT) < 0) {
744
            fprintf(stderr,
745
                    PROGNAME ": Xserver is slow to shutdown, forcing\n");
746
        }
747
        if (killpg(xserver, SIGKILL) < 0) {
748
            if (errno == ESRCH) {
749
                return;
750
            }
751
            perror(PROGNAME ": X server refuses to terminate");
752
        }
753
    }
754
    }
755
756
    /* Wait for client termination */
757
    if (wait_for_exit(client, XCLIENT_KILL_TIMEOUT) < 0) {
758
	fprintf(stderr,
759
		PROGNAME ": X client is slow to shutdown, forcing\n");
760
761
	/* best effort to cleanup session processes */
762
	if (killpg(client, SIGKILL) < 0) {
763
	    if (errno != ESRCH) {
764
		perror(PROGNAME ": X client refuses to terminate");
765
	    }
766
	}
767
    }
754
}
768
}
755
769
756
770
(-)vsm/xsession (-3 lines)
Lines 4-12 Link Here
4
# Copyright 2002-2014 Cendio AB.
4
# Copyright 2002-2014 Cendio AB.
5
# For more information, see http://www.cendio.com
5
# For more information, see http://www.cendio.com
6
6
7
# Ignore SIGHUP, in case Xserver/xinit terminates
8
trap "" SIGHUP
9
10
# Set language on Debian based systems
7
# Set language on Debian based systems
11
if [ -r /etc/default/locale ]; then
8
if [ -r /etc/default/locale ]; then
12
    source /etc/default/locale
9
    source /etc/default/locale
(-)tlmisc/profiles/profiles.hconf.in (-2 / +2 lines)
Lines 97-103 Link Here
97
description=A complete Microsoft® Windows® desktop provided by a separate server with Remote Desktop Services. Extra features such as load balancing and added security is provided by accessing it through this ThinLinc system.
97
description=A complete Microsoft® Windows® desktop provided by a separate server with Remote Desktop Services. Extra features such as load balancing and added security is provided by accessing it through this ThinLinc system.
98
icon=windows.png
98
icon=windows.png
99
screenshot=windows-ss.png
99
screenshot=windows-ss.png
100
cmdline=${TLPREFIX}/bin/tl-run-windesk
100
cmdline=exec ${TLPREFIX}/bin/tl-run-windesk
101
testcmd=${TLPREFIX}/bin/tl-config /appservergroups/rdp/default/servers | grep -v wts1.example.com
101
testcmd=${TLPREFIX}/bin/tl-config /appservergroups/rdp/default/servers | grep -v wts1.example.com
102
description_from_testcmd=false
102
description_from_testcmd=false
103
103
Lines 107-113 Link Here
107
description=A bare bone environment with just a single graphical terminal started. Only meant to be used for debugging and testing.
107
description=A bare bone environment with just a single graphical terminal started. Only meant to be used for debugging and testing.
108
icon=terminal.png
108
icon=terminal.png
109
screenshot=terminal-ss.png
109
screenshot=terminal-ss.png
110
cmdline=xterm || rxvt
110
cmdline=exec xterm || exec rxvt
111
testcmd=type xterm || type rxvt
111
testcmd=type xterm || type rxvt
112
description_from_testcmd=false
112
description_from_testcmd=false
113
113

Return to bug 5696