From 2f4e571e7c11d96cabe2643c702cab1ac8c3b27e Mon Sep 17 00:00:00 2001 From: Brad Fitzpatrick Date: Fri, 8 Aug 2014 10:14:10 -0700 Subject: [PATCH] wkfs: make Create use OpenFile(WRONLY) instead of RDWR Change-Id: Ifbd82b1392a436229fd350a604e1125cf7b1f64d --- pkg/wkfs/wkfs.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pkg/wkfs/wkfs.go b/pkg/wkfs/wkfs.go index 65235fbac..502a893c5 100644 --- a/pkg/wkfs/wkfs.go +++ b/pkg/wkfs/wkfs.go @@ -56,7 +56,9 @@ func OpenFile(name string, flag int, perm os.FileMode) (FileWriter, error) { return fs(name).OpenFile(name, flag, perm) } func Create(name string) (FileWriter, error) { - return OpenFile(name, os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0666) + // like os.Create but WRONLY instead of RDWR because we don't + // expose a Reader here. + return OpenFile(name, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0666) } func fs(name string) FileSystem {