device: fix shadowing of err in IpcHandle
The declaration of err in nextByte, err := buffered.ReadByte shadows the declaration of err in op, err := buffered.ReadString('\n') above. As a result, the assignments to err in err = ipcErrorf(ipc.IpcErrorInvalid, "trailing character in UAPI get: %c", nextByte) and in err = device.IpcGetOperation(buffered.Writer) do not modify the correct err variable. Found by staticcheck. Signed-off-by: Josh Bleecher Snyder <josh@tailscale.com>
This commit is contained in:
parent
d3a2b74df2
commit
37efdcaccf
|
@ -403,7 +403,8 @@ func (device *Device) IpcHandle(socket net.Conn) {
|
||||||
case "set=1\n":
|
case "set=1\n":
|
||||||
err = device.IpcSetOperation(buffered.Reader)
|
err = device.IpcSetOperation(buffered.Reader)
|
||||||
case "get=1\n":
|
case "get=1\n":
|
||||||
nextByte, err := buffered.ReadByte()
|
var nextByte byte
|
||||||
|
nextByte, err = buffered.ReadByte()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue