Skip to content

Commit

Permalink
Merge pull request #109 from tisba/fix-race-condition-ts_utils-make_dir
Browse files Browse the repository at this point in the history
Fix race condition in ts_utils:make_dir/1
  • Loading branch information
nniclausse committed Mar 5, 2015
2 parents d18293a + db44ba7 commit 6e75081
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/tsung/ts_local_mon.erl
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ init([]) ->
LogFileEnc = ts_config_server:decode_filename(?config(log_file)),
FileName = filename:join(LogFileEnc, "tsung-"++Id ++ ".dump"),
LogDir = filename:dirname(FileName),
ts_utils:make_dir_raw(LogDir),
ok = ts_utils:make_dir_raw(LogDir),
case file:open(FileName,[write,raw, delayed_write]) of
{ok, IODev} ->
{ok, #state{dump_iodev=IODev}};
Expand Down
2 changes: 2 additions & 0 deletions src/tsung/ts_utils.erl
Original file line number Diff line number Diff line change
Expand Up @@ -447,6 +447,8 @@ make_dir_rec(Path, FileMod,[Parent|Childs]) ->
case FileMod:make_dir(CurrentDir) of
ok ->
make_dir_rec(CurrentDir, FileMod, Childs);
{error, eexist} ->
make_dir_rec(CurrentDir, FileMod, Childs);
Error ->
Error
end;
Expand Down

0 comments on commit 6e75081

Please sign in to comment.