[fpc-pascal] GetTempFileName in Linux

Jonas Maebe jonas.maebe at elis.ugent.be
Wed Oct 6 10:29:13 CEST 2010


On 06 Oct 2010, at 09:41, Michael Van Canneyt wrote:

> This is always true on Unix, the only way to make sure is to have  
> the kernel
> create the temporary name and file for you. Unix - to my knowledge -  
> does not have a way to create and lock a file in one atomic  
> operation; There are
> always 2 operations involved, and so anything can happen between the 2
> calls.

You can at least open a file with O_CREAT|O_EXCL|O_NOFOLLOW to make  
sure that it does not yet exist at the point that you create it (and  
that it's not a symlink either).


Jonas



More information about the fpc-pascal mailing list