]> rtime.felk.cvut.cz Git - lisovros/qemu_apohw.git/commitdiff
net: truncate output file when using dump backend
authorHervé Poussineau <hpoussin@reactos.org>
Wed, 30 Nov 2011 20:35:37 +0000 (21:35 +0100)
committerAnthony Liguori <aliguori@us.ibm.com>
Tue, 20 Dec 2011 21:44:29 +0000 (15:44 -0600)
This prevents data of a previous run to be seen in the new dump file.

Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
net/dump.c

index 0d0cbb2591ef31bc36ddecb00ba2cbc57bd6da96..81324116f3614cdf3f219d93fe66f2c2cc877182 100644 (file)
@@ -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;