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