]> Cypherpunks repositories - gostls13.git/commitdiff
syscall: let errors.ErrUnsupported match ERROR_NOT_SUPPORTED and ERROR_CALL_NOT_IMPLE...
authorTobias Klauser <tklauser@distanz.ch>
Thu, 16 Mar 2023 18:23:34 +0000 (19:23 +0100)
committerGopher Robot <gobot@golang.org>
Thu, 16 Mar 2023 19:26:36 +0000 (19:26 +0000)
These error codes are returned on windows in case a particular functions
is not supported.

Updates #41198

Change-Id: Ic31755a131d4e7c96961ba54f5bb51026fc7a563
Reviewed-on: https://go-review.googlesource.com/c/go/+/476916
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

src/syscall/syscall_windows.go

index fe052d7e72ed15dfdefd567d9eedd487c0d59416..9f660c1f525e72588dca2a4838c2726abca03f5b 100644 (file)
@@ -142,7 +142,11 @@ func (e Errno) Error() string {
        return string(utf16.Decode(b[:n]))
 }
 
-const _ERROR_BAD_NETPATH = Errno(53)
+const (
+       _ERROR_NOT_SUPPORTED        = Errno(50)
+       _ERROR_BAD_NETPATH          = Errno(53)
+       _ERROR_CALL_NOT_IMPLEMENTED = Errno(120)
+)
 
 func (e Errno) Is(target error) bool {
        switch target {
@@ -162,7 +166,9 @@ func (e Errno) Is(target error) bool {
                        e == ERROR_PATH_NOT_FOUND ||
                        e == ENOENT
        case errorspkg.ErrUnsupported:
-               return e == ENOSYS ||
+               return e == _ERROR_NOT_SUPPORTED ||
+                       e == _ERROR_CALL_NOT_IMPLEMENTED ||
+                       e == ENOSYS ||
                        e == ENOTSUP ||
                        e == EOPNOTSUPP ||
                        e == EWINDOWS