mirror of
https://github.com/rwinkhart/sys.git
synced 2026-09-05 16:47:27 -04: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
|
package unix
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"runtime"
|
||||||
"syscall"
|
"syscall"
|
||||||
"unsafe"
|
"unsafe"
|
||||||
)
|
)
|
||||||
@@ -554,7 +555,9 @@ func Minor(dev uint64) uint32 {
|
|||||||
//sys ioctl(fd int, req uint, arg uintptr) (err error)
|
//sys ioctl(fd int, req uint, arg uintptr) (err error)
|
||||||
|
|
||||||
func IoctlSetTermio(fd int, req uint, value *Termio) (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) {
|
func IoctlGetTermio(fd int, req uint) (*Termio, error) {
|
||||||
|
|||||||
Reference in New Issue
Block a user