Re: Temporary files best practice?
Re: Temporary files best practice?
- Subject: Re: Temporary files best practice?
- From: Wincent Colaiuta <email@hidden>
- Date: Sun, 2 Sep 2007 16:34:08 +0200
El 2/9/2007, a las 16:10, Andrew Merenbach escribió:
What about using -[NSProcessInfo globallyUniqueString] to name your
folder?
Cheers,
Andrew
Any method based on generating/getting a name and then testing for
existence and creating a folder or file with that name has a race
condition. See the mkstemp man page for a better solution:
The mkstemp() function makes the same replacement to the
template and
creates the template file, mode 0600, returning a file
descriptor opened
for reading and writing. This avoids the race between testing
for a
file's existence and opening it for use.
Cheers,
Wincent
_______________________________________________
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