From b2420ebcd1c403d29cd700fdcc032cce07006260 Mon Sep 17 00:00:00 2001 From: Kevin Parsons Date: Tue, 24 Nov 2020 01:37:00 -0800 Subject: [PATCH] Fix Windows service panic file to not be read-only Go 1.14 introduced a change to os.OpenFile (and syscall.Open) on Windows that uses the permissions passed to determine if the file should be created read-only or not. If the user-write bit (0200) is not set, then FILE_ATTRIBUTE_READONLY is set on the underlying CreateFile call. This is a significant change for any Windows code which created new files and set the permissions to 0 (previously the permissions had no affect, so some code didn't set them at all). This change fixes the issue for the Windows service panic file. It will now properly be created as a non-read-only file on Go 1.14+. I have looked over the rest of the containerd code and didn't see other places where this seems like an issue. Signed-off-by: Kevin Parsons --- cmd/containerd/command/service_windows.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/containerd/command/service_windows.go b/cmd/containerd/command/service_windows.go index 34f3d71ea..d683c1836 100644 --- a/cmd/containerd/command/service_windows.go +++ b/cmd/containerd/command/service_windows.go @@ -323,7 +323,7 @@ Loop: func initPanicFile(path string) error { var err error - panicFile, err = os.OpenFile(path, os.O_CREATE|os.O_WRONLY|os.O_APPEND, 0) + panicFile, err = os.OpenFile(path, os.O_CREATE|os.O_WRONLY|os.O_APPEND, 0644) if err != nil { return err }