From: David du Colombier <0intro@gmail.com> Date: Thu, 20 Feb 2014 06:59:38 +0000 (+0100) Subject: os: fix Rename on Plan 9 X-Git-Tag: go1.3beta1~640 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=58a9268f265843e2720adbcbdaf0bc1d367046a1;p=gostls13.git os: fix Rename on Plan 9 Rename should fail when the directory doesn't match. It will fix the newly introduced test from cmd/pack on Plan 9. LGTM=r R=golang-codereviews, r CC=golang-codereviews https://golang.org/cl/65270044 --- diff --git a/src/pkg/os/file_plan9.go b/src/pkg/os/file_plan9.go index e6496558ca..a804b81973 100644 --- a/src/pkg/os/file_plan9.go +++ b/src/pkg/os/file_plan9.go @@ -332,6 +332,8 @@ func rename(oldname, newname string) error { dirname := oldname[:lastIndex(oldname, '/')+1] if hasPrefix(newname, dirname) { newname = newname[len(dirname):] + } else { + return &LinkError{"rename", oldname, newname, ErrInvalid} } // If newname still contains slashes after removing the oldname