From 6514ed528cd6cf752927b4eb38e64bba84c321ff Mon Sep 17 00:00:00 2001 From: Hervé Poussineau Date: Wed, 30 Nov 2011 21:35:37 +0100 Subject: net: truncate output file when using dump backend MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This prevents data of a previous run to be seen in the new dump file. Reviewed-by: Stefan Hajnoczi Signed-off-by: Hervé Poussineau Signed-off-by: Anthony Liguori --- net/dump.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'net/dump.c') diff --git a/net/dump.c b/net/dump.c index 0d0cbb2591..81324116f3 100644 --- a/net/dump.c +++ b/net/dump.c @@ -106,7 +106,7 @@ static int net_dump_init(VLANState *vlan, const char *device, DumpState *s; int fd; - fd = open(filename, O_CREAT | O_WRONLY | O_BINARY, 0644); + fd = open(filename, O_CREAT | O_TRUNC | O_WRONLY | O_BINARY, 0644); if (fd < 0) { error_report("-net dump: can't open %s", filename); return -1; -- cgit v1.2.3