}␊ |
␊ |
//--------------------------------------------------------------------------␊ |
// Execute a priviledge shell command ␊ |
// Execute a priviledge shell command : will wait for execution termination␊ |
// by calling wait()␊ |
//--------------------------------------------------------------------------␊ |
bool executePrivilegedCmd(AuthorizationRef auth, ␊ |
␉␉␉␉␉␉␉␉ const char* pathToTool, ␊ |
|
␊ |
␉// Execute Cmd␊ |
␉OSStatus status = AuthorizationExecuteWithPrivileges(auth, pathToTool,flags, (char**)argv, NULL);␊ |
␉␊ |
␉␊ |
␉// Cleanup mem␊ |
␉// Wait for the child process of AEWP to terminate:␊ |
␉int wait_status=0;␊ |
␉/* pid_t pid = */␊ |
␉wait(&wait_status);␊ |
␉// usleep(10000); // 10 ms␊ |
␉␉// Cleanup mem␊ |
␉for (int i=0; argv[i]; i++) free ((void*) argv[i]);␊ |
␊ |
return status ? false : true;␊ |