I am running an application to remove a script through cocoa, and I noticed that the launchctl command is not executing.
This is part of the code that invokes the script (which contains sudo launchctl unload "daemon name")
NSString* pPath = [pCurrentBundle pathForResource:pFileName ofType:@"sh"];
char* const ppArgs[] = {const_cast<char*>([pPath fileSystemRepresentation]), NULL};
OSStatus status = AuthorizationExecuteWithPrivileges(m_AuthorizationRef, "/bin/sh", kAuthorizationFlagDefaults, ppArgs, NULL);
Since all other script commands are executed properly (and it is unloaded in the terminal), I assume that I do not have the same privileges as root (both EUID and RUID are 0), as indicated in TN2083.
Daesuk chai
source
share