Skip to content

Commit c0f1add

Browse files
kevpardmcgowan
authored andcommitted
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 <[email protected]> (cherry picked from commit b2420eb) Signed-off-by: Derek McGowan <[email protected]>
1 parent 9c24574 commit c0f1add

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

cmd/containerd/command/service_windows.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,7 @@ Loop:
323323

324324
func initPanicFile(path string) error {
325325
var err error
326-
panicFile, err = os.OpenFile(path, os.O_CREATE|os.O_WRONLY|os.O_APPEND, 0)
326+
panicFile, err = os.OpenFile(path, os.O_CREATE|os.O_WRONLY|os.O_APPEND, 0644)
327327
if err != nil {
328328
return err
329329
}

0 commit comments

Comments
 (0)