ssh/terminal: consistent return value for Restore
This patch makes the Restore function return nil
on success to be consistent with other functions
like MakeRaw.
Run-TryBot: Brad Fitzpatrick
TryBot-Result: Gobot Gobot
@@ -72,9 +72,11 @@ func GetState(fd int) (*State, error) {
// Restore restores the terminal connected to the given file descriptor to a
// previous state.
func Restore(fd int, state *State) error {
- _, _, err := syscall.Syscall6(syscall.SYS_IOCTL, uintptr(fd), ioctlWriteTermios, uintptr(unsafe.Pointer(&state.termios)), 0, 0, 0)
+ if _, _, err := syscall.Syscall6(syscall.SYS_IOCTL, uintptr(fd), ioctlWriteTermios, uintptr(unsafe.Pointer(&state.termios)), 0, 0, 0); err != 0 {
return err
}
+ return nil
+}
// GetSize returns the dimensions of the given terminal.
func GetSize(fd int) (width, height int, err error) {
