From: Richard Henderson Date: Tue, 27 Feb 2024 03:07:38 +0000 (-1000) Subject: linux-user/elfload: Truncate core file on open X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=e0add9a835c6259df211eb4874d3d00d9d016796;p=qemu.git linux-user/elfload: Truncate core file on open While we usually create a new corefile, truncate otherwise. Signed-off-by: Richard Henderson --- diff --git a/linux-user/elfload.c b/linux-user/elfload.c index 877799e9c7..16dd08a828 100644 --- a/linux-user/elfload.c +++ b/linux-user/elfload.c @@ -4652,7 +4652,7 @@ static int elf_core_dump(int signr, const CPUArchState *env) { g_autofree char *corefile = core_dump_filename(ts); - fd = open(corefile, O_WRONLY | O_CREAT, + fd = open(corefile, O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); } if (fd < 0) {