Re: [PATCH 7/7] Set a security context on /dev and /dev/pts mounts

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

 



On 01/24/2012 01:21 PM, Eric Blake wrote:
>> +            if (virAsprintf(&opts, "mode=755,size=65536%%%s%s%s",
>> +                            con ? ",context=\"" : "",
>> +                            con ? (const char *)con : "",
>> +                            con ? "\"" : "") < 0) {
> 
> I would have split this:
> 
> if (virAsprintf(&opts, "mode=755,size=65536") < 0 ||
>     (con && virAsprintf(&opts, ",context=\"%s\"",
>                         (const char *)con) < 0)) {

Never mind - that doesn't work; likewise, I don't think we have any
guarantees about self-modifying strings such as:

if (virAsprintf(&opts, "mode=755,size=65536") < 0 ||
    (con && virAsprintf(&opts, "%s,context=\"%s\"",
                        opts, (const char *)con) < 0)) {

I guess I was thinking virBufferAsprintf, where appending is indeed
easier than doing it in one shot.

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

Attachment: signature.asc
Description: OpenPGP digital signature

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]