浏览代码

Don't unnecessarily chmod directories when renaming

Jakob Borg 11 年之前
父节点
当前提交
9a50c4d93f
共有 1 个文件被更改,包括 2 次插入2 次删除
  1. 2 2
      internal/osutil/osutil.go

+ 2 - 2
internal/osutil/osutil.go

@@ -43,8 +43,8 @@ func Rename(from, to string) error {
 
 	// Make sure the destination directory is writeable
 	toDir := filepath.Dir(to)
-	if info, err := os.Stat(toDir); err == nil {
-		os.Chmod(toDir, 0777)
+	if info, err := os.Stat(toDir); err == nil && info.IsDir() && info.Mode()&0200 == 0 {
+		os.Chmod(toDir, 0755)
 		defer os.Chmod(toDir, info.Mode())
 	}