qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 07/60] linux-user/elfload: Truncate core file on open


From: Richard Henderson
Subject: [PATCH 07/60] linux-user/elfload: Truncate core file on open
Date: Fri, 1 Mar 2024 13:05:26 -1000

While we usually create a new corefile, truncate otherwise.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
 linux-user/elfload.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

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) {
-- 
2.34.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]