From a76290f27855c82273a28833e7ae49dfbbd6bcc1 Mon Sep 17 00:00:00 2001 From: Emil Hessman Date: Tue, 4 Nov 2014 21:27:12 +0100 Subject: [PATCH] config/module: don't walk dst when dst is in src Fixes #518 --- config/module/copy_dir.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/config/module/copy_dir.go b/config/module/copy_dir.go index a6628d1d70..f2ae63b77b 100644 --- a/config/module/copy_dir.go +++ b/config/module/copy_dir.go @@ -39,6 +39,11 @@ func copyDir(dst, src string) error { // If we have a directory, make that subdirectory, then continue // the walk. if info.IsDir() { + if path == filepath.Join(src, dst) { + // dst is in src; don't walk it. + return nil + } + if err := os.MkdirAll(dstPath, 0755); err != nil { return err }