Is there a way to open a file (get an fd) and then delete it, in one
atomic operation? 

I need to open a temporary file (but with a fixed name, so mkstemp()
and friends are not an option) and then make sure it doesn't remain
behind if the program should die unexpectedly. Doing

open("foo", ...); 
unlink("foo", ...); 

is obviously unsafe, since foo might be pointing to something else by
the time I unlink it. Suggestions?
-- 
Sterday 20 Forelithe 7466

http://vipe.technion.ac.il/~mulix/
http://syscalltrack.sf.net/

Attachment: msg19963/pgp00000.pgp
Description: PGP signature

Reply via email to