From: Peter Mundy Date: Wed, 21 Jul 2010 16:40:08 +0000 (-0700) Subject: syscall: On Windows, Errstr FormatMessage has no values to insert. X-Git-Tag: weekly.2010-07-29~56 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=6a6d8fdcd30a65d6230891bc421be05db8c3a61f;p=gostls13.git syscall: On Windows, Errstr FormatMessage has no values to insert. For the Windows version of syscall Errstr, set the FORMAT_MESSAGE_IGNORE_INSERTS value of the FormatMessage Flags argument when there are no values to insert. R=rsc, brainman CC=golang-dev https://golang.org/cl/1868043 --- diff --git a/src/pkg/syscall/syscall_windows.go b/src/pkg/syscall/syscall_windows.go index a7f03add44..6aef0ded0e 100644 --- a/src/pkg/syscall/syscall_windows.go +++ b/src/pkg/syscall/syscall_windows.go @@ -142,8 +142,9 @@ func Errstr(errno int) string { if errno == EWINDOWS { return "not supported by windows" } + var flags uint32 = FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_ARGUMENT_ARRAY | FORMAT_MESSAGE_IGNORE_INSERTS b := make([]uint16, 300) - n, err := FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM|FORMAT_MESSAGE_ARGUMENT_ARRAY, 0, uint32(errno), 0, b, nil) + n, err := FormatMessage(flags, 0, uint32(errno), 0, b, nil) if err != 0 { return "error " + str(errno) + " (FormatMessage failed with err=" + str(err) + ")" }