Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/src/pacman/sighandler.c
diff options
context:
space:
mode:
authorAnatol Pomozov <anatol.pomozov@gmail.com>2020-11-03 17:04:38 -0800
committerAllan McRae <allan@archlinux.org>2020-11-26 16:10:26 +1000
commitdb4092e33dacc6a0bb8afd283a82e6f4327cb865 (patch)
treefe41f19f74250430a985311920a1ae7d1d4d1f27 /src/pacman/sighandler.c
parent2859a6eefcb465a382267c6e5981192c6a54f5bb (diff)
Move cursor to the end of the screen at the SIGINT
It requires exposing 'move cursor to the end' function in a pacman header file. We use it as a chance to make naming of the cursor management functions more consistent. Note that there is still possibility of a race condition in the cursor update logic. 'update cursor index variable' and 'send ASCII control symbols to console' is not an atomic operation. So if an SIGINT is received between these two action then cursor position is going to be screwed. Fixes FS#67973 Signed-off-by: Anatol Pomozov <anatol.pomozov@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
Diffstat (limited to 'src/pacman/sighandler.c')
-rw-r--r--src/pacman/sighandler.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/pacman/sighandler.c b/src/pacman/sighandler.c
index fc4ea766..ff9c6ac4 100644
--- a/src/pacman/sighandler.c
+++ b/src/pacman/sighandler.c
@@ -53,6 +53,8 @@ static void _reset_handler(int signum)
*/
static void soft_interrupt_handler(int signum)
{
+ console_cursor_move_end();
+
if(signum == SIGINT) {
const char msg[] = "\nInterrupt signal received\n";
xwrite(STDERR_FILENO, msg, ARRAYSIZE(msg) - 1);
@@ -96,6 +98,7 @@ static void segv_handler(int signum)
sigset_t segvset;
const char msg[] = "\nerror: segmentation fault\n"
"Please submit a full bug report with --debug if appropriate.\n";
+ console_cursor_move_end();
xwrite(STDERR_FILENO, msg, sizeof(msg) - 1);
xwrite(STDOUT_FILENO, CURSOR_SHOW_ANSICODE,
sizeof(CURSOR_SHOW_ANSICODE) - 1);