[fpc-pascal] GetTempFileName in Linux
Michael Van Canneyt
michael at freepascal.org
Thu Oct 7 09:09:17 CEST 2010
On Wed, 6 Oct 2010, Jonathan wrote:
> On Wed, 6 Oct 2010 09:41:03 +0200 (CEST)
> Michael Van Canneyt <michael at freepascal.org> wrote:
>
>> I'm open for some more sophisticated algorithm which does some more checking.
>>
>> Michael.
>
> Honour one of the temp directory environment variables, I know of TMPDIR, TEMP, TMP. I think it would be best to check them in order and then default to /tmp/.
> Create a folder in the temp directory naming it after the user name. E.g /tmp/myusername/
> Ensure only the owner can read and write in the folder.
> Create a folder in "/tmp/myusername/" using your program name.
> Then create your temp file. so you have "/tmp/myusername/programname/tmp01"
>
> You should only need to check for symlinks, hardlinks and read/write rights on the "/tmp/myusername" folder.
>
> What is the cost?
> Two more inodes
> More cpu time
> What do you get?
> It hides the file's names
> Good layout
> Easier to use Tomoyo and Apparmour.
I'm all for it, but I was kind of hoping for an implementation :-)
Michael.
More information about the fpc-pascal
mailing list