Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions serial_unix.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ type unixPort struct {

func (port *unixPort) Close() error {
// Close port
port.releaseExclusiveAccess()
_ = port.releaseExclusiveAccess()
if err := unix.Close(port.handle); err != nil {
return err
}
Expand Down Expand Up @@ -182,7 +182,11 @@ func nativeOpen(portName string, mode *Mode) (*unixPort, error) {

unix.SetNonblock(h, false)

port.acquireExclusiveAccess()
err = port.acquireExclusiveAccess()
if err != nil {
port.Close()
return nil, err
}

// This pipe is used as a signal to cancel blocking Read
pipe := &unixutils.Pipe{}
Expand Down