From fcd8c85d7834c7f35b1d04c55c87dfa9a0d96438 Mon Sep 17 00:00:00 2001 From: Stefano Zacchiroli Date: Wed, 19 Feb 2003 14:28:56 +0000 Subject: [PATCH] bugfix: use temporary file name to avoid file access clashes when the same teporary dir is used by many processes --- helm/ocaml/getter/clientHTTP.ml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/helm/ocaml/getter/clientHTTP.ml b/helm/ocaml/getter/clientHTTP.ml index 7d57c0b57..2444bded3 100644 --- a/helm/ocaml/getter/clientHTTP.ml +++ b/helm/ocaml/getter/clientHTTP.ml @@ -54,9 +54,11 @@ let get_and_save_to_tmp uri = done ; cs in - let user = try Sys.getenv "USER" ^ "_" with Not_found -> "" in - (* FG: Unix.getlogin () should be used instead of the above *) - let tmp_file = Configuration.tmp_dir ^ "/" ^ user ^ (flat_string uri ".-=:;!?/&" '_') in + let user = try Unix.getlogin () with _ -> "" in + let tmp_file = + Filename.temp_file (user ^ flat_string uri ".-=:;!?/&" '_') "" + in get_and_save uri tmp_file ; tmp_file ;; + -- 2.39.2