[launchd-changes] [23918] trunk/launchd/src
source_changes at macosforge.org
source_changes at macosforge.org
Fri May 1 18:13:23 PDT 2009
Revision: 23918
http://trac.macosforge.org/projects/launchd/changeset/23918
Author: dsorresso at apple.com
Date: 2009-05-01 18:13:22 -0700 (Fri, 01 May 2009)
Log Message:
-----------
<rdar://problem/6847675> STD:VSC: /tset/POSIX.upe/ps/ps.ex 814 Failed
Modified Paths:
--------------
trunk/launchd/src/launchd.c
trunk/launchd/src/launchd_core_logic.c
Modified: trunk/launchd/src/launchd.c
===================================================================
--- trunk/launchd/src/launchd.c 2009-05-01 21:54:48 UTC (rev 23917)
+++ trunk/launchd/src/launchd.c 2009-05-02 01:13:22 UTC (rev 23918)
@@ -125,13 +125,12 @@
int
main(int argc, char *const *argv)
{
- const char *stdouterr_path = low_level_debug ? _PATH_CONSOLE : _PATH_DEVNULL;
bool sflag = false;
int ch;
testfd_or_openfd(STDIN_FILENO, _PATH_DEVNULL, O_RDONLY);
- testfd_or_openfd(STDOUT_FILENO, stdouterr_path, O_WRONLY);
- testfd_or_openfd(STDERR_FILENO, stdouterr_path, O_WRONLY);
+ testfd_or_openfd(STDOUT_FILENO, _PATH_DEVNULL, O_WRONLY);
+ testfd_or_openfd(STDERR_FILENO, _PATH_DEVNULL, O_WRONLY);
if (pid1_magic && g_use_gmalloc) {
if (!getenv("DYLD_INSERT_LIBRARIES")) {
@@ -162,10 +161,12 @@
launchd_runtime_init();
if( pid1_magic ) {
- if( low_level_debug ) {
- g_console = stdout;
- } else if( launchd_assumes((g_console = fopen(_PATH_CONSOLE, "w")) != NULL) ) {
- _fd(fileno(g_console));
+ int cfd = -1;
+ if( launchd_assumes((cfd = open(_PATH_CONSOLE, O_WRONLY | O_NOCTTY)) != -1) ) {
+ _fd(cfd);
+ if( !launchd_assumes((g_console = fdopen(cfd, "w")) != NULL) ) {
+ close(cfd);
+ }
}
}
Modified: trunk/launchd/src/launchd_core_logic.c
===================================================================
--- trunk/launchd/src/launchd_core_logic.c 2009-05-01 21:54:48 UTC (rev 23917)
+++ trunk/launchd/src/launchd_core_logic.c 2009-05-02 01:13:22 UTC (rev 23918)
@@ -3501,21 +3501,12 @@
}
} else if( pid1_magic && g_console && kev->ident == (uintptr_t)fileno(g_console) ) {
int cfd = -1;
- if( low_level_debug ) {
- if( jobmgr_assumes(jm, (stdout = freopen(_PATH_CONSOLE, "w", stdout)) != NULL) ) {
- cfd = fileno(stdout);
+ if( launchd_assumes((cfd = open(_PATH_CONSOLE, O_WRONLY | O_NOCTTY)) != -1) ) {
+ _fd(cfd);
+ if( !launchd_assumes((g_console = fdopen(cfd, "w")) != NULL) ) {
+ close(cfd);
}
- g_console = stdout;
- } else {
- if( jobmgr_assumes(jm, (g_console = freopen(_PATH_CONSOLE, "w", g_console)) != NULL) ) {
- cfd = fileno(g_console);
- }
}
-
- if( cfd != -1 ) {
- jobmgr_assumes(jm, kevent_mod((uintptr_t)cfd, EVFILT_VNODE, EV_ADD | EV_ONESHOT, NOTE_REVOKE, 0, jm) != -1);
- _fd(cfd);
- }
}
break;
default:
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/launchd-changes/attachments/20090501/ad8ccf1c/attachment.html>
More information about the launchd-changes
mailing list