Browse Source

discard errno = 0 errors

Victor Vieux 11 years ago
parent
commit
49c62879b8
1 changed files with 8 additions and 0 deletions
  1. 8 0
      term/term.go

+ 8 - 0
term/term.go

@@ -21,11 +21,19 @@ type Winsize struct {
 func GetWinsize(fd uintptr) (*Winsize, error) {
 	ws := &Winsize{}
 	_, _, err := syscall.Syscall(syscall.SYS_IOCTL, fd, uintptr(syscall.TIOCGWINSZ), uintptr(unsafe.Pointer(ws)))
+	// Skipp errno = 0
+	if err == 0 {
+		return ws, nil
+	}
 	return ws, err
 }
 
 func SetWinsize(fd uintptr, ws *Winsize) error {
 	_, _, err := syscall.Syscall(syscall.SYS_IOCTL, fd, uintptr(syscall.TIOCSWINSZ), uintptr(unsafe.Pointer(ws)))
+	// Skipp errno = 0
+	if err == 0 {
+		return nil
+	}
 	return err
 }