Re: predictable filenames problem

Peter Benie (pjb1008@cam.ac.uk)
Fri, 27 Feb 1998 03:05:48 +0000


Tudor Hulubei writes ("predictable filenames problem"):
>
> On the predictable filenames issue: anyone considered having a system
> call that creates a temporary file that doesn't have a directory entry
> (just allocates an inode for it on the file system and returns a file
> descriptor)?

There is already a libc function that opens a file without the
application having to chose a filename - see 'man tmpfile'. Of course,
the temporary file is present in /tmp for a short time, but it's not a
problem provided that the libc implementation is safe.

(A quick examination of the libc5 source reveals that tmpfile opens a
file with flags O_CREAT|O_EXCL and permissions 0666; it relies on your
umask being conservative to keep temporary data private.)

Having a system call would make tmpfile more efficient, but I can't
think of any programs creating so many temporary files that a system
call would make a noticable difference.

Peter

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu