aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/hw/xquartz/mach-startup
diff options
context:
space:
mode:
Diffstat (limited to 'xorg-server/hw/xquartz/mach-startup')
-rw-r--r--xorg-server/hw/xquartz/mach-startup/bundle-main.c15
-rw-r--r--xorg-server/hw/xquartz/mach-startup/launchd_fd.c2
-rw-r--r--xorg-server/hw/xquartz/mach-startup/stub.c30
3 files changed, 19 insertions, 28 deletions
diff --git a/xorg-server/hw/xquartz/mach-startup/bundle-main.c b/xorg-server/hw/xquartz/mach-startup/bundle-main.c
index e887c469d..917bbafbe 100644
--- a/xorg-server/hw/xquartz/mach-startup/bundle-main.c
+++ b/xorg-server/hw/xquartz/mach-startup/bundle-main.c
@@ -149,15 +149,17 @@ static int accept_fd_handoff(int connected_fd) {
char databuf[] = "display";
struct iovec iov[1];
- iov[0].iov_base = databuf;
- iov[0].iov_len = sizeof(databuf);
-
union {
struct cmsghdr hdr;
char bytes[CMSG_SPACE(sizeof(int))];
} buf;
struct msghdr msg;
+ struct cmsghdr *cmsg;
+
+ iov[0].iov_base = databuf;
+ iov[0].iov_len = sizeof(databuf);
+
msg.msg_iov = iov;
msg.msg_iovlen = 1;
msg.msg_control = buf.bytes;
@@ -166,7 +168,7 @@ static int accept_fd_handoff(int connected_fd) {
msg.msg_namelen = 0;
msg.msg_flags = 0;
- struct cmsghdr *cmsg = CMSG_FIRSTHDR (&msg);
+ cmsg = CMSG_FIRSTHDR (&msg);
cmsg->cmsg_level = SOL_SOCKET;
cmsg->cmsg_type = SCM_RIGHTS;
cmsg->cmsg_len = CMSG_LEN(sizeof(int));
@@ -197,6 +199,7 @@ static void socket_handoff_thread(void *arg) {
socket_handoff_t *handoff_data = (socket_handoff_t *)arg;
int launchd_fd = -1;
int connected_fd;
+ unsigned remain;
/* Now actually get the passed file descriptor from this connection
* If we encounter an error, keep listening.
@@ -229,7 +232,7 @@ static void socket_handoff_thread(void *arg) {
* into it.
*/
- unsigned remain = 3000000;
+ remain = 3000000;
fprintf(stderr, "X11.app: Received new $DISPLAY fd: %d ... sleeping to allow xinitrc to catchup.\n", launchd_fd);
while((remain = usleep(remain)) > 0);
@@ -626,11 +629,11 @@ static char *command_from_prefs(const char *key, const char *default_value) {
if ((PlistRef == NULL) || (CFGetTypeID(PlistRef) != CFStringGetTypeID())) {
CFStringRef cfDefaultValue = CFStringCreateWithCString(NULL, default_value, kCFStringEncodingASCII);
+ int len = strlen(default_value) + 1;
CFPreferencesSetAppValue(cfKey, cfDefaultValue, kCFPreferencesCurrentApplication);
CFPreferencesAppSynchronize(kCFPreferencesCurrentApplication);
- int len = strlen(default_value) + 1;
command = (char *)malloc(len * sizeof(char));
if(!command)
return NULL;
diff --git a/xorg-server/hw/xquartz/mach-startup/launchd_fd.c b/xorg-server/hw/xquartz/mach-startup/launchd_fd.c
index fa623ea12..6dace8ea1 100644
--- a/xorg-server/hw/xquartz/mach-startup/launchd_fd.c
+++ b/xorg-server/hw/xquartz/mach-startup/launchd_fd.c
@@ -36,7 +36,7 @@
#include "launchd_fd.h"
-int launchd_display_fd() {
+int launchd_display_fd(void) {
launch_data_t sockets_dict, checkin_request, checkin_response;
launch_data_t listening_fd_array, listening_fd;
diff --git a/xorg-server/hw/xquartz/mach-startup/stub.c b/xorg-server/hw/xquartz/mach-startup/stub.c
index 7a557bd3f..3d22db5d1 100644
--- a/xorg-server/hw/xquartz/mach-startup/stub.c
+++ b/xorg-server/hw/xquartz/mach-startup/stub.c
@@ -69,13 +69,12 @@ static char x11_path[PATH_MAX + 1];
static pid_t x11app_pid = 0;
-static void set_x11_path() {
+static void set_x11_path(void) {
#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1050
CFURLRef appURL = NULL;
CFBundleRef bundle = NULL;
OSStatus osstatus = LSFindApplicationForInfo(kLSUnknownCreator, CFSTR(kX11AppBundleId), nil, nil, &appURL);
- UInt32 ver;
switch (osstatus) {
case noErr:
@@ -96,20 +95,6 @@ static void set_x11_path() {
exit(3);
}
- ver = CFBundleGetVersionNumber(bundle);
- if( !(ver >= 0x02308000 || (ver >= 0x02168000 && ver < 0x02208000))) {
- CFStringRef versionStr = CFBundleGetValueForInfoDictionaryKey(bundle, kCFBundleVersionKey);
- const char * versionCStr = "Unknown";
-
- if(versionStr)
- versionCStr = CFStringGetCStringPtr(versionStr, kCFStringEncodingMacRoman);
-
- fprintf(stderr, "Xquartz: Could not find a new enough X11.app LSFindApplicationForInfo() returned\n");
- fprintf(stderr, " X11.app = %s\n", x11_path);
- fprintf(stderr, " Version = %s (%x), Expected Version > 2.3.0 or 2.1.6\n", versionCStr, (unsigned)ver);
- exit(9);
- }
-
strlcat(x11_path, kX11AppBundlePath, sizeof(x11_path));
#ifdef DEBUG
fprintf(stderr, "Xquartz: X11.app = %s\n", x11_path);
@@ -162,15 +147,17 @@ static void send_fd_handoff(int connected_fd, int launchd_fd) {
char databuf[] = "display";
struct iovec iov[1];
- iov[0].iov_base = databuf;
- iov[0].iov_len = sizeof(databuf);
-
union {
struct cmsghdr hdr;
char bytes[CMSG_SPACE(sizeof(int))];
} buf;
struct msghdr msg;
+ struct cmsghdr *cmsg;
+
+ iov[0].iov_base = databuf;
+ iov[0].iov_len = sizeof(databuf);
+
msg.msg_iov = iov;
msg.msg_iovlen = 1;
msg.msg_control = buf.bytes;
@@ -179,7 +166,7 @@ static void send_fd_handoff(int connected_fd, int launchd_fd) {
msg.msg_namelen = 0;
msg.msg_flags = 0;
- struct cmsghdr *cmsg = CMSG_FIRSTHDR (&msg);
+ cmsg = CMSG_FIRSTHDR (&msg);
cmsg->cmsg_level = SOL_SOCKET;
cmsg->cmsg_type = SCM_RIGHTS;
cmsg->cmsg_len = CMSG_LEN(sizeof(int));
@@ -245,10 +232,11 @@ int main(int argc, char **argv, char **envp) {
kr = bootstrap_look_up(bootstrap_port, server_bootstrap_name, &mp);
if(kr != KERN_SUCCESS) {
+ pid_t child;
set_x11_path();
/* This forking is ugly and will be cleaned up later */
- pid_t child = fork();
+ child = fork();
if(child == -1) {
fprintf(stderr, "Xquartz: Could not fork: %s\n", strerror(errno));
return EXIT_FAILURE;