From 3dc545681de71e5df436761ad301a5770d1e5b4b Mon Sep 17 00:00:00 2001 From: Calascibetta Romain Date: Wed, 22 May 2024 11:47:10 +0200 Subject: [PATCH] Add a comment about our usage of List.hd (which can fail) and String.split_on_char --- dao.ml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/dao.ml b/dao.ml index 3e57781..2e94660 100644 --- a/dao.ml +++ b/dao.ml @@ -81,6 +81,8 @@ let vifs client domid = let get_client_ip () = let* str = Xen_os.Xs.read handle (Fmt.str "%s/%d/ip" path device_id) in let client_ip = List.hd (String.split_on_char ' ' str) in + (* XXX(dinosaure): it's safe to use [List.hd] here, + [String.split_on_char] can not return an empty list. *) Lwt.return_some (vif, Ipaddr.V4.of_string_exn client_ip) in Lwt.catch get_client_ip @@ function