Module Name: xsrc
Committed By: christos
Date: Fri Jan 4 18:53:36 UTC 2019
Modified Files:
xsrc/external/mit/libXau/dist: AuFileName.c
Log Message:
Don't use atexit(3) to free the buffer. Use a destructor instead so we don't
segv if someone dlopened and dlclosed the library. Should fix:
http://mail-index.netbsd.org/tech-userlevel/2018/12/27/msg011624.html
To generate a diff of this commit:
cvs rdiff -u -r1.1.1.2 -r1.2 xsrc/external/mit/libXau/dist/AuFileName.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: xsrc/external/mit/libXau/dist/AuFileName.c
diff -u xsrc/external/mit/libXau/dist/AuFileName.c:1.1.1.2 xsrc/external/mit/libXau/dist/AuFileName.c:1.2
--- xsrc/external/mit/libXau/dist/AuFileName.c:1.1.1.2 Thu May 30 20:34:34 2013
+++ xsrc/external/mit/libXau/dist/AuFileName.c Fri Jan 4 13:53:36 2019
@@ -34,6 +34,9 @@ in this Software without prior written a
static char *buf = NULL;
static void
+#ifdef __NetBSD__
+__attribute__ ((__destructor__))
+#endif
free_filename_buffer(void)
{
free(buf);
@@ -46,7 +49,9 @@ XauFileName (void)
const char *slashDotXauthority = "/.Xauthority";
char *name;
static size_t bsize;
+#ifndef __NetBSD__
static int atexit_registered = 0;
+#endif
#ifdef WIN32
char dir[128];
#endif
@@ -73,10 +78,12 @@ XauFileName (void)
if (!buf)
return NULL;
+#ifndef __NetBSD__
if (!atexit_registered) {
atexit(free_filename_buffer);
atexit_registered = 1;
}
+#endif
bsize = size;
}