[Xquartz-changes] xserver: Branch 'server-1.14-branch' - 2 commits
Jeremy Huddleston
jeremyhu at freedesktop.org
Sun Jan 12 23:10:34 PST 2014
hw/xquartz/X11Controller.m | 8 ++++----
os/osinit.c | 13 +++++++++++--
2 files changed, 15 insertions(+), 6 deletions(-)
New commits:
commit de32ca3f2442bfb90b8cd2135b61758074090018
Author: Jeremy Huddleston Sequoia <jeremyhu at apple.com>
Date: Sat Dec 7 01:36:33 2013 -0800
XQuartz: Use asl_log_descriptor to log stdout/stderr of child processes
Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu at apple.com>
(cherry picked from commit d7c9235ee261b0f780320985233e00dec5e2689c)
diff --git a/hw/xquartz/X11Controller.m b/hw/xquartz/X11Controller.m
index 3d094bf..752bda3 100644
--- a/hw/xquartz/X11Controller.m
+++ b/hw/xquartz/X11Controller.m
@@ -347,7 +347,7 @@ extern char *bundle_id_prefix;
const char *newargv[4];
char buf[128];
char *s;
-#if 0 && MAC_OS_X_VERSION_MAX_ALLOWED >= 1080
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1080
int stdout_pipe[2];
int stderr_pipe[2];
#endif
@@ -363,7 +363,7 @@ extern char *bundle_id_prefix;
setenv("DISPLAY", buf, TRUE);
}
-#if 0 && MAC_OS_X_VERSION_MAX_ALLOWED >= 1080
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1080
if (asl_log_descriptor) {
char *asl_sender;
aslmsg amsg = asl_new(ASL_TYPE_MSG);
@@ -413,7 +413,7 @@ extern char *bundle_id_prefix;
_exit(1);
case 0: /* child2 */
-#if 0 && MAC_OS_X_VERSION_MAX_ALLOWED >= 1080
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1080
if (asl_log_descriptor) {
/* Replace our stdout/stderr */
dup2(stdout_pipe[1], STDOUT_FILENO);
@@ -442,7 +442,7 @@ extern char *bundle_id_prefix;
waitpid(child1, &status, 0);
}
-#if 0 && MAC_OS_X_VERSION_MAX_ALLOWED >= 1080
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1080
if (asl_log_descriptor) {
/* Close the write ends of the pipe */
close(stdout_pipe[1]);
commit 3218c1433f762f2e985c227b4e774cd0fa671009
Author: Jeremy Huddleston Sequoia <jeremyhu at apple.com>
Date: Sat Dec 7 01:14:37 2013 -0800
darwin: Don't leave stdin/stdout closed
<rdar://problem/15609419>
Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu at apple.com>
(cherry picked from commit ad8111d7c971ce448905c733d65ba0cfc72bdca4)
diff --git a/os/osinit.c b/os/osinit.c
index 6c66f9c..0c2c323 100644
--- a/os/osinit.c
+++ b/os/osinit.c
@@ -208,10 +208,18 @@ OsInit(void)
dlinfo(RTLD_SELF, RTLD_DI_SETSIGNAL, &failure_signal);
#endif
-#if !defined(__CYGWIN__)
+#if !defined(XQUARTZ) /* STDIN is already /dev/null and STDOUT/STDERR is managed by console_redirect.c */
+# if defined(__APPLE__)
+ int devnullfd = open(devnull, O_RDWR, 0);
+ assert(devnullfd > 2);
+
+ dup2(devnullfd, STDIN_FILENO);
+ dup2(devnullfd, STDOUT_FILENO);
+ close(devnullfd);
+# elif !defined(__CYGWIN__)
fclose(stdin);
fclose(stdout);
-#endif
+# endif
/*
* If a write of zero bytes to stderr returns non-zero, i.e. -1,
* then writing to stderr failed, and we'll write somewhere else
@@ -245,6 +253,7 @@ OsInit(void)
setlinebuf(stderr);
#endif
}
+#endif /* !XQUARTZ */
#if !defined(WIN32) || defined(__CYGWIN__)
if (getpgrp() == 0)
More information about the Xquartz-changes
mailing list