commit | 2dccfee4fd3e23e10ba17b9d696cf2388c28764b | [log] [tgz] |
---|---|---|
author | Jason A. Donenfeld <Jason@zx2c4.com> | Sat Sep 21 21:22:07 2019 +0200 |
committer | Jason A. Donenfeld <Jason@zx2c4.com> | Sat Sep 21 20:48:32 2019 +0000 |
tree | e16a19a51d62c8b2a7263c47c38321425e5e2927 | |
parent | 5c00192e8ce6429d705e1e4d83b4b22e79482964 [diff] |
windows: do not return invalid error for psuedo-handle functions GetCurrentProcess and GetCurrentThread return -1 and -2 respectively. We could arguably hard code those values, but MSDN cautions not to; I'm sure this advice is old now, given that the psuedo handles for tokens (not processes/threads) are now implemented with inline functions in the headers for Windows 8, but anyway, we'll follow Microsoft's advice. However, regardless of that, these functions never ever return an error. MSDN doesn't indicate that they do, reverse engineering the functions doesn't indicate that they do, and checking against 0 is just plain wrong, considering 0!=INVALID_HANDLE_VALUE; however INVALID_HANDLE_VALUE==-1, so that's not correct either. In fact, checking any value and returning any error does not make sense. Incidently having to check code for the pseudo handle is more verbose too. In order to make this function do the correct thing and meet the spec, remove the error value from the return. Change-Id: If03c9dab001be3bf5a04999aef20dbfcf8a4f405 Reviewed-on: https://go-review.googlesource.com/c/sys/+/196798 Run-TryBot: Jason A. Donenfeld <Jason@zx2c4.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
This repository holds supplemental Go packages for low-level interactions with the operating system.
The easiest way to install is to run go get -u golang.org/x/sys
. You can also manually git clone the repository to $GOPATH/src/golang.org/x/sys
.
This repository uses Gerrit for code changes. To learn how to submit changes to this repository, see https://golang.org/doc/contribute.html.
The main issue tracker for the sys repository is located at https://github.com/golang/go/issues. Prefix your issue with “x/sys:” in the subject line, so it is easy to find.