Skip to content

Commit bf99e49

Browse files
author
Alexandru Scvortov
committed
don't follow symlinks
1 parent 15fcf83 commit bf99e49

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/rabbit_misc.erl

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -749,7 +749,7 @@ recursive_delete(Files) ->
749749
end, ok, Files).
750750

751751
recursive_delete1(Path) ->
752-
case filelib:is_dir(Path) of
752+
case filelib:is_dir(Path) and not(is_symlink(Path)) of
753753
false -> case file:delete(Path) of
754754
ok -> ok;
755755
{error, enoent} -> ok; %% Path doesn't exist anyway
@@ -777,6 +777,12 @@ recursive_delete1(Path) ->
777777
end
778778
end.
779779

780+
is_symlink(Name) ->
781+
case file:read_link(Name) of
782+
{ok, _} -> true;
783+
_ -> false
784+
end.
785+
780786
recursive_copy(Src, Dest) ->
781787
case filelib:is_dir(Src) of
782788
false -> case file:copy(Src, Dest) of

0 commit comments

Comments
 (0)