Projects
Browse Source     Search     Timeline     Wiki

Changeset 23312

Show
Ignore:
Timestamp:
07/16/07 09:54:29 (17 months ago)
Author:
zarzycki@…
Message:

<rdar://problem/5334775> launchctl needs to target root boostrap when run as root

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/launchd/src/launchctl.c

    r23311 r23312  
    217217main(int argc, char *const argv[]) 
    218218{ 
     219        int64_t is_managed = 0; 
    219220        char *l; 
     221 
     222        if ((getuid() == 0) && (vproc_swap_integer(NULL, VPROC_GSK_IS_MANAGED, NULL, &is_managed) == NULL) && (is_managed == 0)) { 
     223                mach_port_t root_bs = str2bsport("/"); 
     224                task_set_bootstrap_port(mach_task_self(), root_bs); 
     225                mach_port_deallocate(mach_task_self(), bootstrap_port); 
     226                bootstrap_port = root_bs; 
     227        } 
    220228 
    221229        istty = isatty(STDIN_FILENO);