Open/create log file with FILE_SHARE_DELETE on windows

Signed-off-by: Lantao Liu <lantaol@google.com>
This commit is contained in:
Lantao Liu
2019-09-03 16:38:08 -07:00
parent 59b6ed641f
commit c6cb25c158
3 changed files with 165 additions and 2 deletions

View File

@@ -20,6 +20,7 @@ package server
import (
"fmt"
"os"
"path"
"path/filepath"
"regexp"
@@ -135,3 +136,8 @@ func (c *criService) apparmorEnabled() bool {
func (c *criService) seccompEnabled() bool {
return runcseccomp.IsEnabled()
}
// openLogFile opens/creates a container log file.
func openLogFile(path string) (*os.File, error) {
return os.OpenFile(path, os.O_CREATE|os.O_APPEND|os.O_WRONLY, 0640)
}