src: Don't rely on virAsprintf() returning string length
In a few places our code relies on the fact that virAsprintf() not only prints to allocated string but also that it returns the length of that string. Fortunately, only few such places were identified: https://www.redhat.com/archives/libvir-list/2019-September/msg01382.html In case of virNWFilterSnoopLeaseFileWrite() and virFilePrintf() we can use strlen() right after virAsprintf() to calculate the length. In case of virDoubleToStr() it's only caller checks for error case only, so we can limit the set of returned values to just [-1, 0]. Signed-off-by: NMichal Privoznik <mprivozn@redhat.com> Reviewed-by: NJán Tomko <jtomko@redhat.com>
Showing
想要评论请 注册 或 登录