>> +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@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/spice-devel

Reply via email to