From: Karel Zak Date: Wed, 24 Jun 2026 11:22:12 +0000 (+0200) Subject: cfdisk: handle SIGHUP to avoid busy-loop on terminal loss X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=174f1842725b8d62b23c97f9d4e4245823807727;p=thirdparty%2Futil-linux.git cfdisk: handle SIGHUP to avoid busy-loop on terminal loss 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 --- diff --git a/disk-utils/cfdisk.c b/disk-utils/cfdisk.c index 023f28161..3bc16e8fe 100644 --- a/disk-utils/cfdisk.c +++ b/disk-utils/cfdisk.c @@ -956,6 +956,7 @@ static int ui_init(struct cfdisk *cf __attribute__((__unused__))) 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);