From d26f8705747ae79c6ccd9173d2e1b2649f59c8f1 Mon Sep 17 00:00:00 2001 From: Andrii Sultanov Date: Tue, 9 Jul 2024 10:44:26 +0100 Subject: [PATCH] Fixes: 99c43569a0 ("Transition from exception-raising Unix.getenv to Sys.getenv_opt with") Signed-off-by: Andrii Sultanov --- ocaml/xapi-idl/lib/xcp_service.ml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ocaml/xapi-idl/lib/xcp_service.ml b/ocaml/xapi-idl/lib/xcp_service.ml index 667e51bd74f..69217d8328c 100644 --- a/ocaml/xapi-idl/lib/xcp_service.ml +++ b/ocaml/xapi-idl/lib/xcp_service.ml @@ -371,10 +371,10 @@ let canonicalise x = split_c ':' (Option.value (Sys.getenv_opt "PATH") ~default:"") in let first_hit = - List.find_opt + List.find_map (fun path -> let possibility = Filename.concat path x in - Sys.file_exists possibility + if Sys.file_exists possibility then Some possibility else None ) (paths @ !extra_search_path) in