Opening a file for writing text in /private/var/log
Opening a file for writing text in /private/var/log
- Subject: Opening a file for writing text in /private/var/log
- From: Pierre Fournier <email@hidden>
- Date: Sun, 13 Jun 2010 17:24:08 +0200
- Importance: Normal
Hi,I want to log something in a file at /private/var/log, using NSFileHandle.With the app launched as root, everything runs ok using [NSFileHandle fileHandleForWritingToURL:url error:&err]. I get a valid handle and can write what I want to.
With the app launched as non-root user, I create an Authorization using AuthorizationCreate(), with following flags:m_AuthFlags = kAuthorizationFlagDefaults | kAuthorizationFlagInteractionAllowed | kAuthorizationFlagExtendRights;
and further use it using AuthorizationCopyRights(m_AuthRef, &m_AuthRights, NULL, m_AuthFlags, NULL)), which returns errAuthorizationSuccess.However, the call of [NSFileHandle fileHandleForWritingToURL:url error:&err] throws the Cocoa Error 13 (Permission Denied).It seems that although having set kAuthorizationFlagExtendRights, I am still not allowed to open and write this file located at /private/var/log.Am I doing something wrong here, to cause such permission denial?Thx.
_________________________________________________________________
La boîte mail NOW Génération vous permet de réunir toutes vos boîtes mail dans Hotmail !
http://www.windowslive.fr/hotmail/nowgeneration/_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden