Re: [PATCH 01/16] util: virstring: Always copy string in virStrcpy

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

 



On a Tuesday in 2021, Peter Krempa wrote:
15 out of 72 invocations of virStrcpy(Static)

That's almost 21%

ignore the return value as
it's either impossible to fail or in certain cases a truncated copy is
still good enough.Unfortunately virStrcpy doesn't copy anything in
such case as the checks are done first.

Fix this by using g_strlcpy for the implementation and removing
G_GNUC_WARN_UNUSED_RESULT from the function so that callers can decide
when it's okay.

Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx>
---
src/util/virstring.c | 12 +++++++-----
src/util/virstring.h |  3 +--
2 files changed, 8 insertions(+), 7 deletions(-)


Reviewed-by: Ján Tomko <jtomko@xxxxxxxxxx>

Jano

Attachment: signature.asc
Description: PGP signature


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

  Powered by Linux