Skip to content

Commit

Permalink
Fix issue #48 (errno 0), #48
Browse files Browse the repository at this point in the history
  • Loading branch information
ipsusila committed Aug 23, 2017
1 parent e50d7d2 commit de14b5c
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions serial_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,13 +143,17 @@ func (p *Port) Write(b []byte) (n int, err error) {
// or data received but not read
func (p *Port) Flush() error {
const TCFLSH = 0x540B
_, _, err := syscall.Syscall(
_, _, errno := syscall.Syscall(
syscall.SYS_IOCTL,
uintptr(p.f.Fd()),
uintptr(TCFLSH),
uintptr(syscall.TCIOFLUSH),
)
return err

if errno == 0 {
return nil
}
return errno
}

func (p *Port) Close() (err error) {
Expand Down

0 comments on commit de14b5c

Please sign in to comment.