From 5b7f08624bae99c250a635b51f112e810147560c Mon Sep 17 00:00:00 2001 From: Szabina Korbai Date: Thu, 16 Apr 2026 15:46:18 +0200 Subject: [PATCH] libutil/util_autocomp_host: Fix script updating MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Force the autocompletion script generator to always write to a new empty file, thus preventing the potential corruption of script contents. Reviewed-by: Jan Höppner Reviewed-by: Steffen Eiden Signed-off-by: Szabina Korbai Signed-off-by: Jan Höppner --- libutil/util_autocomp_host.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libutil/util_autocomp_host.c b/libutil/util_autocomp_host.c index df3493bf..f501bf3b 100644 --- a/libutil/util_autocomp_host.c +++ b/libutil/util_autocomp_host.c @@ -64,7 +64,7 @@ static int init_scriptfile(char *file_path) { int fd; - fd = open(file_path, O_CREAT | O_WRONLY, 0644); + fd = open(file_path, O_CREAT | O_WRONLY | O_TRUNC, 0644); if (fd < 0) return -EIO; return fd;