[libvirt] [PATCH 3/4] virnetdevbandwidthtest: Introduce mocking

Eric Blake eblake at redhat.com
Mon Jan 27 14:24:24 UTC 2014


On 01/27/2014 04:17 AM, Michal Privoznik wrote:

>>
>> This could be simplified with virFileWriteStr().
> 
> Not really. I need to append to the file, while virFileWriteStr() truncate the file prior to writing to it. Always.

That sounds like something that could be fixed, though, if it is a
common enough pattern to want to append rather than truncate.

> 
>>
>>> + +    if (VIR_STRDUP_QUIET(outfile, OUTFILETEMPLATE) < 0) { + 
>>> fprintf(stderr, "Out of memory\n"); +        abort(); +    } + + if
>>> (!mktemp(outfile)) {
>>
>> I'd prefer mkstemp(), for safety.
>>
> 
> Uh.. okay.
> 
> Michal
> 
> 

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 604 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20140127/77ff0e4d/attachment-0001.sig>


More information about the libvir-list mailing list