Secure Coding mailing list archives

temporary directories


From: fw at deneb.enyo.de (Florian Weimer)
Date: Sat, 30 Dec 2006 17:11:06 +0100

I gather you are saying that the innards of Unix will force creation
of an unwanted directory entry on the Ada implementation of the required
null name support for <packagename>.CREATE .  The Ada implementation
could rely on exclusive access to the file (surely Unix has that, right?)

You can create files in a way that fails if the file already exists,
using the O_EXCL flag.  (Rumors have it that this won't work reliably
over NFS, though, but I don't see why.)

coupled with whatever Unix has that passes for the FAB$V_DLT bit to
delete the file on Close (such as at <insert Unix words for image rundown>).

You can delete open files on Unix, so you could in theory unlink it
after creation.

But the whole discussion is moot because existing Ada code seems to
require that temporary files have names. 8-/

But these are problems that have been solved by those who provided the
Ada implementation (ACT and Aonix come to mind for Unix), and thus are
not an issue for the high level language programmer.

AdaCore's implementation used mktemp and featured the usual race
condition.


Current thread: