Commit bd889907 authored by Akshat Kumar's avatar Akshat Kumar Committed by Rob Pike

os: Plan 9: allocate space for a string in Rename

The Name field of the stat structure is variable length
and the marshalling code in package syscall requires
a buf long enough to contain the Name as well as the
static data. This change makes sure that the buffer in
os.Rename is allocated with the appropriate length.

R=rsc, rminnich, ality, r
CC=golang-dev
https://golang.org/cl/7453044
parent 5bffa3b8
......@@ -308,7 +308,7 @@ func Rename(oldname, newname string) error {
d.Null()
d.Name = newname
var buf [syscall.STATFIXLEN]byte
buf := make([]byte, syscall.STATFIXLEN+len(d.Name))
n, err := d.Marshal(buf[:])
if err != nil {
return &PathError{"rename", oldname, err}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment