[pacman-dev] [PATCH] lock file may be left behind when a signal arrives while in cleanup

lilydjwg lilydjwg at gmail.com
Wed Aug 12 05:36:08 UTC 2020


When a SIGINT or SIGHUP arrives before alpm_unlock (in alpm_release) but
after remove_soft_interrupt_handler, the lock file will be left behind.

Signed-off-by: lilydjwg <lilydjwg at gmail.com>
---
 src/pacman/pacman.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/pacman/pacman.c b/src/pacman/pacman.c
index fefd3fa4..2d2e41d2 100644
--- a/src/pacman/pacman.c
+++ b/src/pacman/pacman.c
@@ -287,7 +287,6 @@ static void setuseragent(void)
  */
 static void cleanup(int ret)
 {
-	remove_soft_interrupt_handler();
 	if(config) {
 		/* free alpm library resources */
 		if(config->handle && alpm_release(config->handle) == -1) {
@@ -297,6 +296,7 @@ static void cleanup(int ret)
 		config_free(config);
 		config = NULL;
 	}
+	remove_soft_interrupt_handler();
 
 	/* free memory */
 	FREELIST(pm_targets);
-- 
2.28.0


More information about the pacman-dev mailing list