Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[xsrc/trunk]: xsrc/external/mit/libXxf86dga/dist/src Fix "no output of xdpyin...
details: https://anonhg.NetBSD.org/xsrc/rev/35f3b6777900
branches: trunk
changeset: 10643:35f3b6777900
user: tsutsui <tsutsui%NetBSD.org@localhost>
date: Sat Jan 23 14:41:04 2021 +0000
description:
Fix "no output of xdpyinfo(1) on redirect or pipe" problem.
XF86cleanup() in libXxf86dga invoked via atexit(3)
(or __attribute__((__destructor__)) in NetBSD xsrc)
calls _exit(2) directly so fflush(3) via normal exit(3)
is not called. Analyzed by rin@, ryo@, and soda@:
https://mail-index.netbsd.org/tech-x11/2021/01/20/msg002192.html
Should be pulled up to netbsd-9.
XXX1: The original XF86cleanup() is not async-signale-safe.
XXX2: XF86DGAGetVideo() implicitly overrides signal handlers.
diffstat:
external/mit/libXxf86dga/dist/src/XF86DGA.c | 14 +++++++++++---
1 files changed, 11 insertions(+), 3 deletions(-)
diffs (44 lines):
diff -r 8d52da7b7a73 -r 35f3b6777900 external/mit/libXxf86dga/dist/src/XF86DGA.c
--- a/external/mit/libXxf86dga/dist/src/XF86DGA.c Tue Dec 08 10:33:47 2020 +0000
+++ b/external/mit/libXxf86dga/dist/src/XF86DGA.c Sat Jan 23 14:41:04 2021 +0000
@@ -650,14 +650,14 @@
#ifdef __NetBSD__
__attribute__ ((__destructor__))
#endif
-XF86cleanup(int sig)
+XF86cleanup_atexit(void)
{
ScrPtr sp;
int i;
static char beenhere = 0;
if (beenhere)
- _exit(3);
+ return;
beenhere = 1;
for (i = 0; i < numScrs; i++) {
@@ -665,6 +665,14 @@
XF86DGADirectVideo(sp->display, sp->screen, 0);
XSync(sp->display, False);
}
+}
+
+static void
+XF86cleanup(int sig)
+{
+ /* XXX FIXME XF86cleanup_atexit() is not async-signal-safe */
+ XF86cleanup_atexit();
+
_exit(3);
}
@@ -707,7 +715,7 @@
if (!beenHere) {
beenHere = 1;
#ifndef __NetBSD__
- atexit((void(*)(void))XF86cleanup);
+ atexit((void(*)(void))XF86cleanup_atexit);
#endif
/* one shot XF86cleanup attempts */
signal(SIGSEGV, XF86cleanup);
Home |
Main Index |
Thread Index |
Old Index