]> git.ipfire.org Git - thirdparty/wireguard-go.git/commit
device: fix shadowing of err in IpcHandle
authorJosh Bleecher Snyder <josh@tailscale.com>
Tue, 26 Jan 2021 18:35:25 +0000 (10:35 -0800)
committerJason A. Donenfeld <Jason@zx2c4.com>
Tue, 26 Jan 2021 21:40:10 +0000 (22:40 +0100)
commit37efdcaccfb16e47137728b5462c90d0b2ae8460
tree65742a085905331b0e8c7501ac1c0dbc64ff2854
parentd3a2b74df28ea7d7e90918c4431a38853990ce72
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>
device/uapi.go