From 9922d2aef644c32b849b317ca4468d7c248ffbef Mon Sep 17 00:00:00 2001 From: jsorg71 Date: Thu, 6 Aug 2009 19:01:09 +0000 Subject: [PATCH] added x_server_running_check_ports --- sesman/session.c | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/sesman/session.c b/sesman/session.c index 68f45693..29caeac4 100644 --- a/sesman/session.c +++ b/sesman/session.c @@ -85,7 +85,7 @@ session_get_bydata(char* name, int width, int height, int bpp) * */ static int DEFAULT_CC -x_server_running(int display) +x_server_running_check_ports(int display) { char text[256]; int x_running; @@ -122,6 +122,31 @@ x_server_running(int display) return x_running; } +/******************************************************************************/ +/** + * + * @brief checks if there's a server running on a display + * @param display the display to check + * @return 0 if there isn't a display running, nonzero otherwise + * + */ +static int DEFAULT_CC +x_server_running(int display) +{ + char text[256]; + int x_running; + int sck; + + g_sprintf(text, "/tmp/.X11-unix/X%d", display); + x_running = g_file_exist(text); + if (!x_running) + { + g_sprintf(text, "/tmp/.X%d-lock", display); + x_running = g_file_exist(text); + } + return x_running; +} + /******************************************************************************/ static void DEFAULT_CC session_start_sessvc(int xpid, int wmpid, long data) @@ -215,7 +240,7 @@ session_get_aval_display_from_chain(void) { if (!session_is_display_in_chain(display)) { - if (!x_server_running(display)) + if (!x_server_running_check_ports(display)) { lock_chain_release(); return display;