Fix failure to rename directory

os.Rename validates that the target doesn't exist, which is different from
syscall.Rename which replace the target if both are directories. fsgofer needs
the syscall behavior.

PiperOrigin-RevId: 196194630
Change-Id: I87d08cad88b5ef310b245cd91647c4f5194159d8
This commit is contained in:
Fabricio Voznika
2018-05-10 17:13:10 -07:00
committed by Shentubot
parent 7b6111b695
commit 7cff8489de
+1 -1
View File
@@ -708,7 +708,7 @@ func (l *localFile) Rename(directory p9.File, name string) error {
// TODO: change to renameat(2)
parent := directory.(*localFile)
newPath := path.Join(parent.hostPath, name)
if err := os.Rename(l.hostPath, newPath); err != nil {
if err := syscall.Rename(l.hostPath, newPath); err != nil {
return extractErrno(err)
}