diff options
author | Siri Hansen <[email protected]> | 2011-06-15 10:21:00 +0200 |
---|---|---|
committer | Siri Hansen <[email protected]> | 2011-06-15 10:21:00 +0200 |
commit | 099f7ed216ab80e7ffa0618fdd77f2e221d052b4 (patch) | |
tree | 4a7da8da913193de273e48d43b906d24766cb037 /lib | |
parent | bcb07ea53beca828b628f3744096eddb9d5923a8 (diff) | |
parent | 3719237f9dc14ff01772009ba1c61fe47b17080c (diff) | |
download | otp-099f7ed216ab80e7ffa0618fdd77f2e221d052b4.tar.gz otp-099f7ed216ab80e7ffa0618fdd77f2e221d052b4.tar.bz2 otp-099f7ed216ab80e7ffa0618fdd77f2e221d052b4.zip |
Merge branch 'siri/stdlib/ensure-dir-no-read-access/OTP-9368' into dev
* siri/stdlib/ensure-dir-no-read-access/OTP-9368:
Allow erl_tar to create directories inside directory with no read access
Diffstat (limited to 'lib')
-rw-r--r-- | lib/stdlib/src/erl_tar.erl | 30 |
1 files changed, 5 insertions, 25 deletions
diff --git a/lib/stdlib/src/erl_tar.erl b/lib/stdlib/src/erl_tar.erl index fd85c7aef5..306834e845 100644 --- a/lib/stdlib/src/erl_tar.erl +++ b/lib/stdlib/src/erl_tar.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1997-2009. All Rights Reserved. +%% Copyright Ericsson AB 1997-2011. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -798,30 +798,10 @@ set_extracted_file_info(Name, #tar_header{mode=Mode, mtime=Mtime}) -> %% Makes all directories leading up to the file. -make_dirs(Name, Type) -> - make_dirs1(filename:split(Name), Type). - -make_dirs1([Dir, Next|Rest], Type) -> - case file:read_file_info(Dir) of - {ok, #file_info{type=directory}} -> - make_dirs1([filename:join(Dir, Next)|Rest], Type); - {ok, #file_info{}} -> - throw({error, enotdir}); - {error, _} -> - case file:make_dir(Dir) of - ok -> - make_dirs1([filename:join(Dir, Next)|Rest], Type); - {error, Reason} -> - throw({error, Reason}) - end - end; -make_dirs1([_], file) -> ok; -make_dirs1([Dir], dir) -> - file:make_dir(Dir); -make_dirs1([], _) -> - %% There must be something wrong here. The list was not supposed - %% to be empty. - throw({error, enoent}). +make_dirs(Name, file) -> + filelib:ensure_dir(Name); +make_dirs(Name, dir) -> + filelib:ensure_dir(filename:join(Name,"*")). %% Prints the message on if the verbose option is given (for reading). |