tempnam/mktemp

Morris M. Keesan keesan at bbncc5.UUCP
Wed Aug 21 07:29:26 AEST 1985


In article <458 at baylor.UUCP> peter at baylor.UUCP (Peter da Silva) writes:
>If tempnam/mktemp does anything more than sprintf(fname, "/tmp/tmp%d%d",
>getpid(), cnt++), what it does escapes me. 

mktemp returns a file name that is guaranteed not to exist (modulo race
conditions), which affords you some protection against bozos who are
making temp files using rand() instead of getpid(), e.g.
-- 
Morris M. Keesan
keesan at bbn-unix.ARPA
{decvax,ihnp4,etc.}!bbncca!keesan



More information about the Comp.unix.wizards mailing list