[libvirt] [PATCH] build: prefer mkostemp for multi-thread safety

Eric Blake eblake at redhat.com
Wed Oct 31 16:10:24 UTC 2012


On 10/31/2012 09:45 AM, Martin Kletzander wrote:
> On 10/31/2012 03:42 PM, Eric Blake wrote:
>> https://bugzilla.redhat.com/show_bug.cgi?id=871756
>>
>> Commit cd1e8d1 assumed that systems new enough to have journald
>> also have mkostemp; but this is not true for uclibc.
>>
>> For that matter, use of mkstemp[s] is unsafe in a multi-threaded
>> program.  We should prefer mkostemp[s] in the first place.

>> -    fd = mkstemps(ret, 4);
>> +    fd = mkostemps(ret, 4, O_CLOEXEC);
>>      if (fd == -1) {
>>          vshError(ctl, _("mkstemps: failed to create temporary file: %s"),
> 
> This message should be changed as well.
> 
>>                   virStrerror(errno, ebuf, sizeof(ebuf)));
>>
> 
> ACK with that changed.

Fixed and pushed.  Hopefully Leonardo can give libvirt.git a test (since
we probably won't have any more rc builds between now and 1.0.0 on Friday).

-- 
Eric Blake   eblake at 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: 617 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20121031/e40e830a/attachment-0001.sig>


More information about the libvir-list mailing list