Revision: 23312 http://trac.macosforge.org/projects/launchd/changeset/23312 Author: zarzycki@apple.com Date: 2007-07-16 09:54:29 -0700 (Mon, 16 Jul 2007) Log Message: ----------- <rdar://problem/5334775> launchctl needs to target root boostrap when run as root Modified Paths: -------------- trunk/launchd/src/launchctl.c Modified: trunk/launchd/src/launchctl.c =================================================================== --- trunk/launchd/src/launchctl.c 2007-07-16 16:46:32 UTC (rev 23311) +++ trunk/launchd/src/launchctl.c 2007-07-16 16:54:29 UTC (rev 23312) @@ -216,8 +216,16 @@ int main(int argc, char *const argv[]) { + int64_t is_managed = 0; char *l; + if ((getuid() == 0) && (vproc_swap_integer(NULL, VPROC_GSK_IS_MANAGED, NULL, &is_managed) == NULL) && (is_managed == 0)) { + mach_port_t root_bs = str2bsport("/"); + task_set_bootstrap_port(mach_task_self(), root_bs); + mach_port_deallocate(mach_task_self(), bootstrap_port); + bootstrap_port = root_bs; + } + istty = isatty(STDIN_FILENO); argc--, argv++;
participants (1)
-
source_changes@macosforge.org