summaryrefslogtreecommitdiff
path: root/launchd
diff options
context:
space:
mode:
authorJeremy Huddleston <jeremy@yuffie.local>2007-12-15 15:52:22 -0800
committerJeremy Huddleston <jeremy@yuffie.local>2007-12-15 15:52:22 -0800
commit3c5ae3a242895f53d4f27fefb785f2725077a55d (patch)
tree3aa2bbff25ca22946223e2c80afed44d0c7688e2 /launchd
parentf5db2f6bc21b8d589b92c0f1d60bd6ec8da21ae0 (diff)
Changed x11-exec to actually start X11.app. X11.app will be responsible for calling xinit.
Diffstat (limited to 'launchd')
-rw-r--r--launchd/Makefile.am4
-rw-r--r--launchd/org.x.X11.plist.cpp7
-rw-r--r--launchd/x11-exec.c22
3 files changed, 27 insertions, 6 deletions
diff --git a/launchd/Makefile.am b/launchd/Makefile.am
index 6a420e6..b841df8 100644
--- a/launchd/Makefile.am
+++ b/launchd/Makefile.am
@@ -6,7 +6,9 @@ endif
launchagents_PRE = org.x.X11.plist.pre
launchagents_DATA = $(launchagents_PRE:plist.pre=plist)
-CPP_FILES_FLAGS = -D__bindir__="$(bindir)"
+CPP_FILES_FLAGS = \
+ -D__libexecdir__="$(libexecdir)" \
+ -D__bindir__="$(bindir)"
CLEANFILES = $(launchagents_DATA)
diff --git a/launchd/org.x.X11.plist.cpp b/launchd/org.x.X11.plist.cpp
index 822f1f7..6aed8d8 100644
--- a/launchd/org.x.X11.plist.cpp
+++ b/launchd/org.x.X11.plist.cpp
@@ -6,9 +6,12 @@
<string>org.x.X11</string>
<key>ProgramArguments</key>
<array>
- <string>__bindir__/startx</string>
- <string>--</string>
+#ifdef __APPLE__
+ <string>__libexecdir__/x11-exec</string>
<string>-launchd</string>
+#else
+ <string>__bindir__/startx</string>
+#endif
</array>
<key>Sockets</key>
<dict>
diff --git a/launchd/x11-exec.c b/launchd/x11-exec.c
index 60e3934..bc1a233 100644
--- a/launchd/x11-exec.c
+++ b/launchd/x11-exec.c
@@ -30,6 +30,7 @@
#include <CoreServices/CoreServices.h>
#include <stdio.h>
+#include <unistd.h>
#define kX11AppBundleId "org.x.X11"
#define kX11AppBundlePath "/Contents/MacOS/X11"
@@ -53,16 +54,31 @@ int main(int argc, char **argv) {
exit(2);
}
- printf("%s/%s\n", x11_path, kX11AppBundlePath);
+ strlcat(x11_path, kX11AppBundlePath, sizeof(x11_path));
+ fprintf(stderr, "X11.app = %s\n", x11_path);
- exit(0);
+ args = (char**)malloc(sizeof (char*) * (argc + 1));
+ if (args) {
+ int i;
+ args[0] = x11_path;
+ for (i = 1; i < argc; ++i) {
+ args[i] = argv[i];
+ }
+ args[i] = NULL;
+ }
+
+ execv(x11_path, args);
+
+ fprintf(stderr, "Error executing X11.app (%s):", x11_path);
+ perror(NULL);
+ exit(3);
break;
case kLSApplicationNotFoundErr:
fprintf(stderr, "%s: Unable to find application for %s\n", argv[0], kX11AppBundleId);
exit(4);
default:
fprintf(stderr, "%s: Unable to find application for %s, error code = %d\n",
- argv[0], kX11AppBundleId, osstatus);
+ argv[0], kX11AppBundleId, (int)osstatus);
exit(5);
}
/* not reached */