[libvirt] [PATCH] Optimization of the check for valid interface name

Stefan Berger stefanb at us.ibm.com
Fri Apr 2 18:11:07 UTC 2010


The attached patch optimizes the validation of the name of an interface.

Signed-off-by: Stefan Berger

Index: libvirt-acl/src/conf/domain_conf.c
===================================================================
--- libvirt-acl.orig/src/conf/domain_conf.c
+++ libvirt-acl/src/conf/domain_conf.c
@@ -1795,7 +1795,7 @@ cleanup:
 
 static bool
 isValidIfname(const char *ifname) {
-    return (strspn(ifname, VALID_IFNAME_CHARS) == strlen(ifname));
+    return ifname[strspn(ifname, VALID_IFNAME_CHARS)] == 0;
 }
 
 




More information about the libvir-list mailing list