Re: [PATCH v2] udev: fix crash in libudev logging

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

 



On 14.06.2013 10:53, Guannan Ren wrote:
> On 06/13/2013 09:56 PM, Ján Tomko wrote:
>> Call virLogVMessage instead of virLogMessage, since libudev
>> called us with a va_list object, not a list of arguments.
>>
>> Honor message priority and strip the trailing newline.
>>
>> https://bugzilla.redhat.com/show_bug.cgi?id=969152
>> ---
>> v1: https://www.redhat.com/archives/libvir-list/2013-June/msg00349.html
>> v2: don't ignore priority and strip the trailing newline.
> 
>> +typedef void (*udevLogFunctionPtr)(struct udev *udev,
>> +                                   int priority,
>> +                                   const char *file,
>> +                                   int line,
>> +                                   const char *fn,
>> +                                   const char *format,
>> +                                   va_list args);
>> +
>> +static void
>> +ATTRIBUTE_FMT_PRINTF(6,0)
>> +udevLogFunction(struct udev *udev ATTRIBUTE_UNUSED,
>> +                int priority,
>> +                const char *file,
>> +                int line,
>> +                const char *fn,
>> +                const char *fmt,
>> +                va_list args)
>>   {
>> -    VIR_ERROR_INT(VIR_LOG_FROM_LIBRARY, file, line, fn, fmt, args);
>> +    virBuffer buf = VIR_BUFFER_INITIALIZER;
>> +    const char *format = NULL;
>> +
>> +    virBufferAdd(&buf, fmt, -1);
>> +    virBufferTrim(&buf, "\n", -1);
>> +
> 
>           We need a virBufferError checking here before formatting into
> a string.

In which case we want to got with fmt as provided.

Michal

--
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]