File dwz-0.12-clean-up-temporary-file-in-hardlink-mode.patch of Package dwz.33026
From ee42ec7ce6634441c427936873648f92f46cf94c Mon Sep 17 00:00:00 2001
From: Tom de Vries <tdevries@suse.de>
Date: Wed, 20 Mar 2024 14:28:07 +0100
Subject: [PATCH] Clean up temporary file in hardlink mode
This is a minimal fix for PR dwz/24275, fixed in dwz 0.14 by commit
commit 05d5540 ("Clean up temporary file in hardlink mode").
---
dwz.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/dwz.c b/dwz.c
index b3b779d..c2fc708 100644
--- a/dwz.c
+++ b/dwz.c
@@ -11025,6 +11025,12 @@ dwz (const char *file, const char *outfile, struct file_result *res,
if (rename (filename, file) == 0)
{
close (fd);
+ /* Filename and file are not supposed to be existing
+ hard links referring to the same file, but they can
+ be (PR24275). In that case, rename does nothing,
+ and a temporary file remains. Clean up the
+ temporary file. */
+ unlink (filename);
res->res = -2;
return 0;
}
base-commit: be35c03955bcf6e4e4a1cab1af46bb4e729284b3
--
2.35.3