Skip to content

Commit 33a779e

Browse files
committed
Properly type handles to prevent overflows
This change is needed for 32 bit targets as the default type is int32 and the handle constants do not fit into it. Signed-off-by: Jiri Appl <[email protected]>
1 parent deac65c commit 33a779e

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

cmd/dockerd/service_windows.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -396,8 +396,8 @@ func initPanicFile(path string) error {
396396
// Update STD_ERROR_HANDLE to point to the panic file so that Go writes to
397397
// it when it panics. Remember the old stderr to restore it before removing
398398
// the panic file.
399-
sh := windows.STD_ERROR_HANDLE
400-
h, err := windows.GetStdHandle(uint32(sh))
399+
sh := uint32(windows.STD_ERROR_HANDLE)
400+
h, err := windows.GetStdHandle(sh)
401401
if err != nil {
402402
return err
403403
}
@@ -421,7 +421,7 @@ func initPanicFile(path string) error {
421421
func removePanicFile() {
422422
if st, err := panicFile.Stat(); err == nil {
423423
if st.Size() == 0 {
424-
sh := windows.STD_ERROR_HANDLE
424+
sh := uint32(windows.STD_ERROR_HANDLE)
425425
setStdHandle.Call(uintptr(sh), uintptr(oldStderr))
426426
panicFile.Close()
427427
os.Remove(panicFile.Name())

0 commit comments

Comments
 (0)