[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: mkstemp
- From: David Given <dg@...>
- Date: Sat, 15 Apr 2006 21:55:54 +0100
Christian Vogler wrote:
> handle = mkstemp(filename)
**** race condition here! If the process' umask isn't set correctly,
another process might open the file. ****
> chmod(handle) such that file is only readable and writable by owner
> ... use file ..
tmpfile() is a better option; it's defined to do this stuff *for* you, so
you don't have to, and risk getting it wrong.
+- David Given --McQ-+ "If you're up against someone more intelligent
| email@example.com | than you are, do something insane and let him think
| (firstname.lastname@example.org) | himself to death." --- Pyanfar Chanur
+- www.cowlark.com --+