From 05bc7180dda8fd16bb581e7e756a4dcdc2e9b418 Mon Sep 17 00:00:00 2001 From: deuce <> Date: Sat, 14 Jul 2012 07:53:48 +0000 Subject: [PATCH] For UNIX systems, use the C99 _Exit() instead of exit() in the random child to avoid bad interactions with the SDL atexit() handlers. --- 3rdp/build/GNUmakefile | 1 + 3rdp/build/random_exit.patch | 38 ++++++++++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+) create mode 100644 3rdp/build/random_exit.patch diff --git a/3rdp/build/GNUmakefile b/3rdp/build/GNUmakefile index 7b4e5b4c5b..7488cfaf4f 100644 --- a/3rdp/build/GNUmakefile +++ b/3rdp/build/GNUmakefile @@ -46,6 +46,7 @@ $(CRYPTLIB_BUILD): $(3RDP_ROOT)$(DIRSEP)dist/cryptlib.zip | $(CRYPT_SRC) $(CRYPT @echo Creating $@ ... $(QUIET)-rm -rf $(CRYPT_SRC)/* $(QUIET)unzip -oa $(3RDPDISTDIR)$(DIRSEP)cryptlib.zip -d $(CRYPT_SRC) + $(QUIET)patch -d $(CRYPT_SRC) < random_exit.patch $(QUIET)patch -d $(CRYPT_SRC) < SSL-fix.patch ifdef DEBUG $(QUIET)env - PATH=$(PATH) make -C $(CRYPT_SRC) debug diff --git a/3rdp/build/random_exit.patch b/3rdp/build/random_exit.patch new file mode 100644 index 0000000000..f8411824cc --- /dev/null +++ b/3rdp/build/random_exit.patch @@ -0,0 +1,38 @@ +--- random/unix.c.orig 2012-07-14 00:50:55.000000000 -0700 ++++ random/unix.c 2012-07-14 00:52:28.000000000 -0700 +@@ -161,7 +161,7 @@ + process, which calls exit() rather than returning */ + + #define ENSURES_EXIT( x ) \ +- if( !( x ) ) { assert( INTERNAL_ERROR ); exit( -1 ); } ++ if( !( x ) ) { assert( INTERNAL_ERROR ); _Exit( -1 ); } + + /* The structure containing information on random-data sources. Each record + contains the source and a relative estimate of its usefulness (weighting) +@@ -544,7 +544,7 @@ + /* We are the child, connect the read side of the pipe to stdout and + unplug stdin and stderr */ + if( dup2( pipedes[ STDOUT_FILENO ], STDOUT_FILENO ) < 0 ) +- exit( 127 ); ++ _Exit( 127 ); + if( ( fd = open( "/dev/null", O_RDWR ) ) > 0 ) + { + dup2( fd, STDIN_FILENO ); +@@ -616,7 +616,7 @@ + #ifdef HAS_VFORK + _exit( 127 ); + #else +- exit( 127 ); ++ _Exit( 127 ); + #endif /* Unixen that have vfork() */ + } + +@@ -1539,7 +1539,7 @@ + + /* "Thou child of the daemon, ... wilt thou not cease...?" + -- Acts 13:10 */ +- exit( 0 ); ++ _Exit( 0 ); + } + + /* Unix slow poll. If a few of the randomness sources create a large amount -- GitLab