Browse Source

Don't unnecessarily chmod directories when renaming

Jakob Borg 11 years ago
parent
commit
9a50c4d93f
1 changed files with 2 additions and 2 deletions
  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())
 	}