Make it more similar to virStringStripSuffix(). Signed-off-by: Andrea Bolognani <abologna@xxxxxxxxxx> --- src/util/virstring.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/util/virstring.c b/src/util/virstring.c index e47d76accd..ba36562f85 100644 --- a/src/util/virstring.c +++ b/src/util/virstring.c @@ -1294,12 +1294,16 @@ virStringMatchesNameSuffix(const char *file, int namelen = strlen(name); int suffixlen = strlen(suffix); - if (filelen == (namelen + suffixlen) && - STREQLEN(file, name, namelen) && - STREQLEN(file + namelen, suffix, suffixlen)) - return true; - else + if (filelen != (namelen + suffixlen)) + return false; + + if (STRNEQLEN(file, name, namelen)) return false; + + if (STRNEQLEN(file + namelen, suffix, suffixlen)) + return false; + + return true; } /** -- 2.20.1 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list