summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorFabricio Voznika <fvoznika@google.com>2018-05-10 17:12:21 -0700
committerShentubot <shentubot@google.com>2018-05-10 17:13:10 -0700
commit7cff8489de2254cf355ec81cebc2338e0035f2df (patch)
tree96d5a2a96fa19af7064a87d858d51b2afda6b208
parent7b6111b695840ab2938abe0d207514dd34081327 (diff)
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
-rw-r--r--runsc/fsgofer/fsgofer.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/runsc/fsgofer/fsgofer.go b/runsc/fsgofer/fsgofer.go
index 11dd28cef..cd6224de3 100644
--- a/runsc/fsgofer/fsgofer.go
+++ b/runsc/fsgofer/fsgofer.go
@@ -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)
}