Skip to content

Commit f11e5e4

Browse files
tklausergopherbot
authored andcommitted
unix: use unsafe.Slice in (*FileHandle).Bytes
Change-Id: Ic2b88577ec6fd975bbba0538790d2ff312d85d3f Reviewed-on: https://go-review.googlesource.com/c/sys/+/435776 Reviewed-by: Benny Siegert <[email protected]> TryBot-Result: Gopher Robot <[email protected]> Auto-Submit: Tobias Klauser <[email protected]> Run-TryBot: Tobias Klauser <[email protected]> Reviewed-by: Dmitri Shuralyov <[email protected]>
1 parent 6fa7a7c commit f11e5e4

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

unix/syscall_linux.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2252,7 +2252,7 @@ func (fh *FileHandle) Bytes() []byte {
22522252
if n == 0 {
22532253
return nil
22542254
}
2255-
return (*[1 << 30]byte)(unsafe.Pointer(uintptr(unsafe.Pointer(&fh.fileHandle.Type)) + 4))[:n:n]
2255+
return unsafe.Slice((*byte)(unsafe.Pointer(uintptr(unsafe.Pointer(&fh.fileHandle.Type))+4)), n)
22562256
}
22572257

22582258
// NameToHandleAt wraps the name_to_handle_at system call; it obtains

0 commit comments

Comments
 (0)