• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Opening a file for writing text in /private/var/log
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Follow-Ups:
    • Re: Opening a file for writing text in /private/var/log
      • From: Ken Thomases <email@hidden>
    • Re: Opening a file for writing text in /private/var/log
      • From: Nick Zitzmann <email@hidden>
  • Prev by Date: Image pinching and double tapping issue.
  • Next by Date: Re: How to debug invalidated core data object
  • Previous by thread: Image pinching and double tapping issue.
  • Next by thread: Re: Opening a file for writing text in /private/var/log
  • Index(es):
    • Date
    • Thread