Re: [PATCH xf86-video-qxl 3/3] XSpice: auto generate temp files for the vdagent process.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



>> +if args.vdagent_enabled:
>> +    for f in [args.vdagent_udcs_path, args.vdagent_virtio_path, args.vdagent_uinput_path]:
>> +        if f and os.path.exists(f):
>> +            os.unlink(f)
>> +
>> +    if not cf:
>> +        cf = tempfile.NamedTemporaryFile(prefix="Xspice-vdagent-", delete=True)
>> +    # Auto generate temporary files for vdagent
>> +    if not args.vdagent_udcs_path:
>> +        args.vdagent_udcs_path = cf.name + ".udcs"
>> +    if not args.vdagent_virtio_path:
>> +        args.vdagent_virtio_path = cf.name + ".virtio"
>> +    if not args.vdagent_uinput_path:
>> +        args.vdagent_uinput_path = cf.name + ".uinput"
> 
> This does not look correct, while the 'cf' file will be guaranteed
> unique, accessible only by the current user, ..., there is no such
> guarantee for cf.name+".udcs" and the other variations. I think you need
> one NamedTemporaryFile per file extension (possibly in the
> tempfile.gettempdir() + "Xspice-vdagent" directory).

Technically, you're right.  In practice, I suspect it will never matter.
 But it's fairly easy (and perhaps tidier) to tuck all these files down
in a uniquely named directory, so I'll do that.

I'm afraid this script is not the height of elegance :-/.

Cheers,

Jeremy


_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/spice-devel




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]