Skip to content

Commit

Permalink
recvtty: fix errcheck linter warnings
Browse files Browse the repository at this point in the history
Fixes the following errcheck linter warnings

> contrib/cmd/recvtty/recvtty.go:115:10: Error return value of `io.Copy` is not checked (errcheck)
> 		io.Copy(os.Stdout, c)
> 		       ^
> contrib/cmd/recvtty/recvtty.go:120:11: Error return value of `io.Copy` is not checked (errcheck)
> 			io.Copy(c, os.Stdin)
> 			       ^
> contrib/cmd/recvtty/recvtty.go:175:11: Error return value of `io.Copy` is not checked (errcheck)
>			io.Copy(devnull, master)
>			       ^

Signed-off-by: Kir Kolyshkin <[email protected]>
  • Loading branch information
kolyshkin committed Nov 30, 2020
1 parent 5bfae52 commit 6506564
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions contrib/cmd/recvtty/recvtty.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,24 +111,32 @@ func handleSingle(path string, noStdin bool) error {
}

// Copy from our stdio to the master fd.
var wg sync.WaitGroup
var (
wg sync.WaitGroup
inErr, outErr error
)
wg.Add(1)
go func() {
io.Copy(os.Stdout, c)
_, outErr = io.Copy(os.Stdout, c)
wg.Done()
}()
if !noStdin {
wg.Add(1)
go func() {
io.Copy(c, os.Stdin)
_, inErr = io.Copy(c, os.Stdin)
wg.Done()
}()
}

// Only close the master fd once we've stopped copying.
wg.Wait()
c.Close()
return nil

if outErr != nil {
return outErr
}

return inErr
}

func handleNull(path string) error {
Expand Down Expand Up @@ -168,7 +176,7 @@ func handleNull(path string) error {
return
}

io.Copy(ioutil.Discard, master)
_, _ = io.Copy(ioutil.Discard, master)
}(conn)
}
}
Expand Down

0 comments on commit 6506564

Please sign in to comment.