8000 fix: better handling of mkdir races by rgrinberg · Pull Request #5613 · ocaml/dune · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

fix: better handling of mkdir races #5613

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions otherlibs/stdune/fpath.ml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ type mkdir_p_result =
| Already_exists
| Created

let rec mkdir_p ?(perms = 0o777) t_s =
match mkdir ~perms t_s with
let rec mkdir_p ?perms t_s =
match mkdir ?perms t_s with
| Created -> Created
| Already_exists -> Already_exists
| Missing_parent_directory -> (
Expand All @@ -31,8 +31,8 @@ let rec mkdir_p ?(perms = 0o777) t_s =
[]
else
let parent = Filename.dirname t_s in
match mkdir_p ~perms parent with
| Created | Already_exists ->
match mkdir_p ?perms parent with
| Created | Already_exists -> (
(* The [Already_exists] case might happen if some other process managed
to create the parent directory concurrently. *)
Unix.mkdir t_s perms;
Expand Down
0