Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[xsrc/netbsd-9]: xsrc/external/mit/libXxf86dga/dist/src Pull up following rev...



details:   https://anonhg.NetBSD.org/xsrc/rev/939a959177ce
branches:  netbsd-9
changeset: 10644:939a959177ce
user:      martin <martin%NetBSD.org@localhost>
date:      Thu Feb 04 17:15:55 2021 +0000

description:
Pull up following revision(s) (requested by tsutsui in ticket #1194):

        external/mit/libXxf86dga/dist/src/XF86DGA.c: revision 1.3

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 16008213efd5 -r 939a959177ce external/mit/libXxf86dga/dist/src/XF86DGA.c
--- a/external/mit/libXxf86dga/dist/src/XF86DGA.c       Mon Dec 07 20:18:55 2020 +0000
+++ b/external/mit/libXxf86dga/dist/src/XF86DGA.c       Thu Feb 04 17:15:55 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