From 58a9268f265843e2720adbcbdaf0bc1d367046a1 Mon Sep 17 00:00:00 2001 From: David du Colombier <0intro@gmail.com> Date: Thu, 20 Feb 2014 07:59:38 +0100 Subject: [PATCH] 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 --- src/pkg/os/file_plan9.go | 2 ++ 1 file changed, 2 insertions(+) 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 -- 2.48.1