When the controlling terminal disappears (e.g., a web terminal
session is closed), the kernel sends SIGHUP. Without handling it,
cfdisk's getch() returns ERR in a tight loop, causing 100% CPU
usage indefinitely.
Register SIGHUP with the existing sig_handler_die() so that all
loops exit via the existing sig_die checks.
Addresses: https://github.com/util-linux/util-linux/pull/4385
Signed-off-by: Karel Zak <kzak@redhat.com>
sa.sa_handler = sig_handler_die;
sigaction(SIGINT, &sa, NULL);
sigaction(SIGTERM, &sa, NULL);
+ sigaction(SIGHUP, &sa, NULL);
sa.sa_handler = sig_handler_resize;
sigaction(SIGWINCH, &sa, NULL);