[Libguestfs] [PATCH v3 17/22] v2v: -o libvirt: Use PCRE to verify arch is sane.

Richard W.M. Jones rjones at redhat.com
Fri Sep 22 07:36:18 UTC 2017


---
 v2v/output_libvirt.ml | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/v2v/output_libvirt.ml b/v2v/output_libvirt.ml
index b5df8245f..bc7f41ff9 100644
--- a/v2v/output_libvirt.ml
+++ b/v2v/output_libvirt.ml
@@ -28,8 +28,8 @@ open Xpath_helpers
 open Create_libvirt_xml
 
 let arch_is_sane_or_die =
-  let rex = Str.regexp "^[-_A-Za-z0-9]+$" in
-  fun arch -> assert (Str.string_match rex arch 0)
+  let rex = PCRE.compile ~caseless:true "^[-_a-z0-9]+$" in
+  fun arch -> assert (PCRE.matches rex arch)
 
 let target_features_of_capabilities_doc doc arch =
   let xpathctx = Xml.xpath_new_context doc in
-- 
2.13.2




More information about the Libguestfs mailing list