aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/hw/xquartz/mach-startup
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2009-10-12 19:43:36 +0000
committermarha <marha@users.sourceforge.net>2009-10-12 19:43:36 +0000
commit821ad28aad2f8c3cf4bbef9c8ac053943603cc67 (patch)
tree741a72dab536c86c7c3d815d93574d1404b42a51 /xorg-server/hw/xquartz/mach-startup
parentf18b881b547c558dca584d68d45ace998fa49d18 (diff)
parent0c5e1ab504b4e8c56974a234bd440e9fa2f1f941 (diff)
downloadvcxsrv-821ad28aad2f8c3cf4bbef9c8ac053943603cc67.tar.gz
vcxsrv-821ad28aad2f8c3cf4bbef9c8ac053943603cc67.tar.bz2
vcxsrv-821ad28aad2f8c3cf4bbef9c8ac053943603cc67.zip
svn merge ^/branches/released .
Diffstat (limited to 'xorg-server/hw/xquartz/mach-startup')
-rw-r--r--xorg-server/hw/xquartz/mach-startup/Makefile.in3
-rw-r--r--xorg-server/hw/xquartz/mach-startup/bundle-main.c77
-rw-r--r--xorg-server/hw/xquartz/mach-startup/stub.c2
3 files changed, 48 insertions, 34 deletions
diff --git a/xorg-server/hw/xquartz/mach-startup/Makefile.in b/xorg-server/hw/xquartz/mach-startup/Makefile.in
index 42fd1cf92..47d174c19 100644
--- a/xorg-server/hw/xquartz/mach-startup/Makefile.in
+++ b/xorg-server/hw/xquartz/mach-startup/Makefile.in
@@ -171,6 +171,7 @@ DEPDIR = @DEPDIR@
DGA_CFLAGS = @DGA_CFLAGS@
DGA_LIBS = @DGA_LIBS@
DIX_CFLAGS = @DIX_CFLAGS@
+DIX_LIB = @DIX_LIB@
DLLTOOL = @DLLTOOL@
DMXEXAMPLES_DEP_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@
DMXEXAMPLES_DEP_LIBS = @DMXEXAMPLES_DEP_LIBS@
@@ -263,6 +264,7 @@ OBJCFLAGS = @OBJCFLAGS@
OBJCLINK = @OBJCLINK@
OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@
+OS_LIB = @OS_LIB@
OTOOL = @OTOOL@
OTOOL64 = @OTOOL64@
PACKAGE = @PACKAGE@
@@ -379,7 +381,6 @@ build_vendor = @build_vendor@
builddir = @builddir@
datadir = @datadir@
datarootdir = @datarootdir@
-distcleancheck_listfiles = @distcleancheck_listfiles@
docdir = @docdir@
driverdir = @driverdir@
dvidir = @dvidir@
diff --git a/xorg-server/hw/xquartz/mach-startup/bundle-main.c b/xorg-server/hw/xquartz/mach-startup/bundle-main.c
index 917bbafbe..146ea11d8 100644
--- a/xorg-server/hw/xquartz/mach-startup/bundle-main.c
+++ b/xorg-server/hw/xquartz/mach-startup/bundle-main.c
@@ -80,7 +80,8 @@ const char *__crashreporter_info__base = "X.Org X Server " XSERVER_VERSION " Bui
char __crashreporter_info__buf[4096];
char *__crashreporter_info__ = __crashreporter_info__buf;
-static char *server_bootstrap_name = LAUNCHD_ID_PREFIX".X11";
+static char *launchd_id_prefix = NULL;
+static char *server_bootstrap_name = NULL;
#define DEBUG 1
@@ -456,6 +457,7 @@ static void setup_env(void) {
char *temp;
const char *pds = NULL;
const char *disp = getenv("DISPLAY");
+ size_t len;
/* Pass on our prefs domain to startx and its inheritors (mainly for
* quartz-wm and the Xquartz stub's MachIPC)
@@ -465,45 +467,56 @@ static void setup_env(void) {
CFStringRef pd = CFBundleGetIdentifier(bundle);
if(pd) {
pds = CFStringGetCStringPtr(pd, 0);
- if(pds) {
- server_bootstrap_name = malloc(sizeof(char) * (strlen(pds) + 1));
- strcpy(server_bootstrap_name, pds);
- setenv("X11_PREFS_DOMAIN", pds, 1);
- }
}
}
+
+ /* fallback to hardcoded value if we can't discover it */
+ if(!pds) {
+ pds = LAUNCHD_ID_PREFIX".X11";
+ }
+
+ server_bootstrap_name = malloc(sizeof(char) * (strlen(pds) + 1));
+ if(!server_bootstrap_name) {
+ fprintf(stderr, "Memory allocation error.\n");
+ exit(1);
+ }
+ strcpy(server_bootstrap_name, pds);
+ setenv("X11_PREFS_DOMAIN", server_bootstrap_name, 1);
+
+ len = strlen(server_bootstrap_name);
+ launchd_id_prefix = malloc(sizeof(char) * (len - 3));
+ if(!launchd_id_prefix) {
+ fprintf(stderr, "Memory allocation error.\n");
+ exit(1);
+ }
+ strlcpy(launchd_id_prefix, server_bootstrap_name, len - 3);
+
/* We need to unset DISPLAY if it is not our socket */
if(disp) {
- if(!pds) {
- /* If we can't detet our id, we are beyond hope and need to just
- * revert to the non-launchd startup */
- unsetenv("DISPLAY");
- } else {
- /* s = basename(disp) */
- const char *d, *s;
+ /* s = basename(disp) */
+ const char *d, *s;
for(s = NULL, d = disp; *d; d++) {
- if(*d == '/')
- s = d + 1;
- }
-
- if(s && *s) {
- size_t pds_len = strlen(pds);
- temp = (char *)malloc(sizeof(char) * pds_len);
- if(!temp) {
- fprintf(stderr, "Memory allocation error creating space for socket name test.\n");
- }
- strlcpy(temp, pds, pds_len - 3);
- strlcat(temp, ":0", pds_len);
+ if(*d == '/')
+ s = d + 1;
+ }
- if(strcmp(temp, s) != 0) {
- /* If we don't have a match, unset it. */
- unsetenv("DISPLAY");
- }
- free(temp);
- } else {
- /* The DISPLAY environment variable is not formatted like a launchd socket, so reset. */
+ if(s && *s) {
+ temp = (char *)malloc(sizeof(char) * len);
+ if(!temp) {
+ fprintf(stderr, "Memory allocation error creating space for socket name test.\n");
+ exit(1);
+ }
+ strlcpy(temp, launchd_id_prefix, len);
+ strlcat(temp, ":0", len);
+
+ if(strcmp(temp, s) != 0) {
+ /* If we don't have a match, unset it. */
unsetenv("DISPLAY");
}
+ free(temp);
+ } else {
+ /* The DISPLAY environment variable is not formatted like a launchd socket, so reset. */
+ unsetenv("DISPLAY");
}
}
diff --git a/xorg-server/hw/xquartz/mach-startup/stub.c b/xorg-server/hw/xquartz/mach-startup/stub.c
index 3d22db5d1..8f670353a 100644
--- a/xorg-server/hw/xquartz/mach-startup/stub.c
+++ b/xorg-server/hw/xquartz/mach-startup/stub.c
@@ -205,7 +205,7 @@ int main(int argc, char **argv, char **envp) {
sig_t handler;
if(argc == 2 && !strcmp(argv[1], "-version")) {
- fprintf(stderr, "X.org Release 7.4\n");
+ fprintf(stderr, "X.org Release 7.5\n");
fprintf(stderr, "X.Org X Server %s\n", XSERVER_VERSION);
fprintf(stderr, "Build Date: %s\n", BUILD_DATE);
return EXIT_SUCCESS;