[cmd] Open zedmon.csv with O_TRUNC, i.e. truncate the file
Opening the file without truncating it only really makes sense if we
are appending to the file.
Also, O_RDWR isn't necessary: we can use O_WRONLY instead.
Change-Id: Ie0f1b142d08a4a3a77c52c5850814ab0cee80314
diff --git a/cmd/zedmon/record.go b/cmd/zedmon/record.go
index 9aec977..1c71cb6 100644
--- a/cmd/zedmon/record.go
+++ b/cmd/zedmon/record.go
@@ -61,7 +61,7 @@
}
defer zedmon.Close()
- f, err := os.OpenFile("zedmon.csv", os.O_CREATE|os.O_RDWR, 0666)
+ f, err := os.OpenFile("zedmon.csv", os.O_CREATE|os.O_WRONLY|os.O_TRUNC, 0666)
if err != nil {
fmt.Printf("Can't open zedmon.csv: %v", err)
return subcommands.ExitFailure