Projects
Factory:RISC-V:Base
util-linux
_service:tar_scm:backport-lib-pager-fix-signal-...
Sign Up
Log In
Username
Password
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File _service:tar_scm:backport-lib-pager-fix-signal-safety-issues.patch of Package util-linux
From 518a0ad4d9c586ca69d3cf924a4328361f6b2a80 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cristian=20Rodr=C3=ADguez?= <crrodriguez@opensuse.org> Date: Sun, 15 Jan 2023 01:33:14 +0000 Subject: [PATCH] lib:pager: fix signal safety issues - Cannot use stdio in signal handlers, so you cannot safely call fflush. - cannot call exit() but only _exit() --- lib/pager.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/pager.c b/lib/pager.c index e5bd07a47..8f62310c0 100644 --- a/lib/pager.c +++ b/lib/pager.c @@ -114,7 +114,9 @@ static int wait_or_whine(pid_t pid) if (waiting < 0) { if (errno == EINTR) continue; - err(EXIT_FAILURE, _("waitpid failed (%s)"), strerror(errno)); + /* Can't err() on signal handler */ + ignore_result(write(STDERR_FILENO, "waitpid failed", 14)); + _exit(EXIT_FAILURE); } if (waiting != pid) return -1; @@ -163,8 +165,6 @@ static void wait_for_pager(void) if (pager_process.pid == 0) return; - fflush(stdout); - fflush(stderr); /* signal EOF to pager */ close(STDOUT_FILENO); close(STDERR_FILENO); -- 2.27.0
Locations
Projects
Search
Status Monitor
Help
Open Build Service
OBS Manuals
API Documentation
OBS Portal
Reporting a Bug
Contact
Mailing List
Forums
Chat (IRC)
Twitter
Open Build Service (OBS)
is an
openSUSE project
.
浙ICP备2022010568号-2