Merge pull request #15146 from kolyshkin/mkdirall

Simplify and fix MkdirAll usage
This commit is contained in:
Tibor Vass 2015-07-30 22:40:57 -04:00
commit 352f58a5e2

View file

@ -720,7 +720,7 @@ func (archiver *Archiver) CopyWithTar(src, dst string) error {
} }
// Create dst, copy src's content into it // Create dst, copy src's content into it
logrus.Debugf("Creating dest directory: %s", dst) logrus.Debugf("Creating dest directory: %s", dst)
if err := system.MkdirAll(dst, 0755); err != nil && !os.IsExist(err) { if err := system.MkdirAll(dst, 0755); err != nil {
return err return err
} }
logrus.Debugf("Calling TarUntar(%s, %s)", src, dst) logrus.Debugf("Calling TarUntar(%s, %s)", src, dst)
@ -752,7 +752,7 @@ func (archiver *Archiver) CopyFileWithTar(src, dst string) (err error) {
dst = filepath.Join(dst, filepath.Base(src)) dst = filepath.Join(dst, filepath.Base(src))
} }
// Create the holding directory if necessary // Create the holding directory if necessary
if err := system.MkdirAll(filepath.Dir(dst), 0700); err != nil && !os.IsExist(err) { if err := system.MkdirAll(filepath.Dir(dst), 0700); err != nil {
return err return err
} }