[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: mkstemp
- From: Klaus Ripke <paul-lua@...>
- Date: Sun, 16 Apr 2006 01:15:49 +0200
On Sat, Apr 15, 2006 at 05:13:04PM -0400, Christian Vogler wrote:
> Oops, right. You have to call umask first.
well, you should in order to improve your chances
that all processes accessing the file are cooperative.
However, this helps only as far as other users are concerned,
not for other processes running with your account.
> Problem is that in some libraries it does not. :-(
and in others it's broken.
On some network filesystems there is no reliable way to do it.
> So, what can one do?
on posix you use open(2) with O_CREAT|O_EXCL,
which is safe with regard to cooperative processes.
For windoze there are similar options to CreateFile,
plus you can inhibit any sharing.
tmpfile(3), even if implemented correctly,
makes no guarantee as to who can access the file.
regards