From 4ba9e03367e1b7d4cc84242a6a94d8c02c1f9369 Mon Sep 17 00:00:00 2001 From: malc Date: Fri, 24 Feb 2012 16:38:28 +0400 Subject: [PATCH] Robustness --- wsi.ml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/wsi.ml b/wsi.ml index c2ccac1..1e69b03 100644 --- a/wsi.ml +++ b/wsi.ml @@ -710,10 +710,15 @@ let getauth haddr dnum = in let path = try Sys.getenv "XAUTHORITY" - with Not_found -> Filename.concat (Sys.getenv "HOME") ".Xauthority" + with Not_found -> + try Filename.concat (Sys.getenv "HOME") ".Xauthority" + with Not_found -> "" in let opt = - try Some (open_in_bin path) + try + if String.length path = 0 + then None + else Some (open_in_bin path) with exn -> dolog "failed to open X authority file `%S' : %s" path -- 2.11.4.GIT