Question on os.tempnam() vulnerability

Grant Edwards grante at visi.com
Sat Jan 5 09:40:06 EST 2008


On 2008-01-05, Jarek Zgoda <jzgoda at o2.usun.pl> wrote:

>> Under Windows, is there a "safe" way to create a temp file
>> that has a name that can be passed to a program which will
>> then open it? I never figured out a way to do that and had to
>> fall back on the "unsafe" tmpnam method.
>
> I think it's all impossible to get only file name and feel
> safe. You have to have both file name and a file object opened
> exclusively for you. Any other way you'll get a possible race
> condition.

I know.  That's the point of my question: how do you do that
under Windows?

-- 
Grant Edwards                   grante             Yow!  HAIR TONICS, please!!
                                  at               
                               visi.com            



More information about the Python-list mailing list