[pacman-dev] [PATCH 03/11] pacman: exit without memory cleanup on signals

Andrew Gregory andrew.gregory.8 at gmail.com
Fri Dec 4 20:31:34 UTC 2015


Memory allocation/deallocation functions are not safe to call from
signal handlers.  Just remove the lock file if there is one and exit
immediately.

Fixes: FS#46375, FS#45995, FS#47011

Signed-off-by: Andrew Gregory <andrew.gregory.8 at gmail.com>
---
 src/pacman/pacman.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/pacman/pacman.c b/src/pacman/pacman.c
index 94685a7..1d4459e 100644
--- a/src/pacman/pacman.c
+++ b/src/pacman/pacman.c
@@ -336,10 +336,10 @@ static void handler(int signum)
 	}
 	/* SIGINT/SIGHUP: no committing transaction, release it now and then exit pacman
 	 * SIGTERM: release no matter what */
-	alpm_trans_release(config->handle);
+	alpm_unlock(config->handle);
 	/* output a newline to be sure we clear any line we may be on */
 	xwrite(out, "\n", 1);
-	cleanup(128 + signum);
+	_Exit(128 + signum);
 }
 
 static void invalid_opt(int used, const char *opt1, const char *opt2)
-- 
2.6.3


More information about the pacman-dev mailing list