From a0b8e10ffd5a6083637f322f88d60e3798ef9d17 Mon Sep 17 00:00:00 2001 From: malc Date: Fri, 12 Oct 2012 10:54:39 +0400 Subject: [PATCH] Robustness --- main.ml | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/main.ml b/main.ml index fb22000..3ac45b1 100644 --- a/main.ml +++ b/main.ml @@ -6404,16 +6404,19 @@ struct ) with | Some ic -> - begin try + let success = + try f (do_load get ic) with exn -> prerr_endline ("Error loading configuation from `" ^ !confpath ^ "': " ^ Printexc.to_string exn); - end; + false + in close_in ic; + success - | None -> () + | None -> false else f (Hashtbl.create 0, defconf) ;; @@ -6433,6 +6436,7 @@ struct if conf.jumpback then state.anchor <- pa; cbput state.hists.nav pa; + true in load1 f ;; @@ -6765,9 +6769,9 @@ struct then adddoc path x anchor c bookmarks ) h; Buffer.add_string bb ""; + true; in - load1 f; - if Buffer.length bb > 0 + if load1 f && Buffer.length bb > 0 then try let tmp = !confpath ^ ".tmp" in @@ -6812,7 +6816,8 @@ let () = if String.length state.path = 0 then (prerr_endline "file name missing"; exit 1); - Config.load (); + if not (Config.load ()) + then prerr_endline "failed to load configuration"; let globalkeyhash = findkeyhash conf "global" in let wsfd, winw, winh = Wsi.init (object -- 2.11.4.GIT