From c85f24fda206898d6603f4f5656d386453796f6f Mon Sep 17 00:00:00 2001 From: Mrunal Patel Date: Thu, 17 Mar 2016 15:12:35 -0700 Subject: [PATCH] Sync on the pid file to ensure the write is persisted Signed-off-by: Mrunal Patel --- utils.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils.go b/utils.go index a2ffae488..4081a6d5f 100644 --- a/utils.go +++ b/utils.go @@ -281,7 +281,7 @@ func createPidFile(path string, process *libcontainer.Process) error { tmpDir = filepath.Dir(path) tmpName = filepath.Join(tmpDir, fmt.Sprintf(".%s", filepath.Base(path))) ) - f, err := os.OpenFile(tmpName, os.O_RDWR|os.O_CREATE|os.O_EXCL, 0666) + f, err := os.OpenFile(tmpName, os.O_RDWR|os.O_CREATE|os.O_EXCL|os.O_SYNC, 0666) if err != nil { return err }