mirror of
https://github.com/golang/sys.git
synced 2026-02-09 04:06:04 +03:00
unix: use runtime.KeepAlive in Solaris IoctlSetTermio
This ensures that value remains live for the duration of the ioctl system call. This pattern is used in all other IoctlSet* functions but appears to have been forgotten here. Change-Id: I2b26a5c4e7c862f779427b839327b36c1bc78c82 Reviewed-on: https://go-review.googlesource.com/c/sys/+/259637 Trust: Matt Layher <mdlayher@gmail.com> Run-TryBot: Matt Layher <mdlayher@gmail.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
This commit is contained in:
@@ -13,6 +13,7 @@
|
||||
package unix
|
||||
|
||||
import (
|
||||
"runtime"
|
||||
"syscall"
|
||||
"unsafe"
|
||||
)
|
||||
@@ -554,7 +555,9 @@ func Minor(dev uint64) uint32 {
|
||||
//sys ioctl(fd int, req uint, arg uintptr) (err error)
|
||||
|
||||
func IoctlSetTermio(fd int, req uint, value *Termio) (err error) {
|
||||
return ioctl(fd, req, uintptr(unsafe.Pointer(value)))
|
||||
err := ioctl(fd, req, uintptr(unsafe.Pointer(value)))
|
||||
runtime.KeepAlive(value)
|
||||
return err
|
||||
}
|
||||
|
||||
func IoctlGetTermio(fd int, req uint) (*Termio, error) {
|
||||
|
||||
Reference in New Issue
Block a user