Hi All,
  Thanks for the replies, however I'm noticing from the snippet below

FILE* commsPipe = NULL;

DEBUG_SHOW(CFStringCreateWithFormat(kCFAllocatorDefault, NULL, CFSTR("Call external Tool (%s) withs Args(%s)."), cmd, pArguments) ); err = (WirelessError)AuthorizationExecuteWithPrivileges([auth authorizationRef], &cmd[0], (unsigned long)kAuthorizationFlagDefaults, argumentsChown, &commsPipe );
if ( err == noErr )
{
  NSLog(@"Waiting for profile tool to finish.");
  int child; wait(&child);
  close(fileno(commsPipe));
  NSLog(@"profile tool has finished.");
}

I notice from the NSLog's outputs that this code doesn't seem to be waiting for that launched tool to finish, as I have also put some NSLogs within the tool itself, as I do not see NSLog's timestamps match up, as I would expect to see the timestamp of the above 'tool has finished' to be the last in console log, however I see timestamps after the 'wait' has returned.

  Am I missing something here ?

Thanks
Mark.

On 14 Sep 2009, at 20:57, Mark Thomas wrote:

Hi ALL,
I was wondering if anybody could tell me if it's correct to use authorizationExecuteWithPrivileges and wait() calls together, so the parent process wait's until that new child process finishes. Googling seems to imply this from the examples I've seen.

However reading the documentation (within XCode) the authorizationExecuteWithPrivileges, doesn't mention that the privileged process is actually a child of the process which executed this ? As while I can understand this, I thought maybe another process actually launched the requested executable as root.

Thanks for any clarifications, as I would like to be sure this is correct way to wait for process to finish when I call authorizationExecuteWithPrivileges, and not this how it works today.

Thanks
Mark.

_______________________________________________

Cocoa-dev mailing list ([email protected])

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to