Blob Blame History Raw
Description: <short summary of the patch>
 TODO: Put a short summary on the line above and replace this paragraph
 with a longer explanation of this change. Complete the meta-information
 with other relevant fields (see below for details). To make it easier, the
 information below has been extracted from the changelog. Adjust it or drop
 it.
 .
 gcl (2.6.12-21) unstable; urgency=medium
 .
   * Version_2_6_13pre26
Author: Camm Maguire <camm@debian.org>

---
The information above should follow the Patch Tagging Guidelines, please
checkout http://dep.debian.net/deps/dep3/ to learn about the format. Here
are templates for supplementary fields that you might want to add:

Origin: <vendor|upstream|other>, <url of original patch>
Bug: <url in upstream bugtracker>
Bug-Debian: https://bugs.debian.org/<bugnumber>
Bug-Ubuntu: https://launchpad.net/bugs/<bugnumber>
Forwarded: <no|not-needed|url proving that it has been forwarded>
Reviewed-By: <name and email of someone who approved the patch>
Last-Update: <YYYY-MM-DD>

--- gcl-2.6.12.orig/h/att_ext.h
+++ gcl-2.6.12/h/att_ext.h
@@ -217,6 +217,10 @@ frame_ptr frs_sch_catch();
 /*  gbc.c  */
 EXTER bool GBC_enable;
 
+#ifdef CAN_UNRANDOMIZE_SBRK
+EXTER bool gcl_unrandomized;
+#endif
+
 /*  let.c  */
 
 /*  lex.c  */
--- gcl-2.6.12.orig/h/gnuwin95.h
+++ gcl-2.6.12/h/gnuwin95.h
@@ -7,15 +7,6 @@
 #define DBEGIN_TY unsigned long
 extern DBEGIN_TY _dbegin;
 
-
-
-/* define if there is no _cleanup,   do here what needs
-   to be done before calling unexec
-   */   
-#define CLEANUP_CODE \
-  setbuf(stdin,0); \
-   setbuf(stdout,0);
-
 /* size to use for mallocs done  */
 /* #define BABY_MALLOC_SIZE 0x5000 */
 
--- gcl-2.6.12.orig/h/linux.h
+++ gcl-2.6.12/h/linux.h
@@ -130,10 +130,6 @@ do { int c = 0; \
 
 #define SET_SESSION_ID() (setpgrp() ? -1 : 0)
 
-#define CLEANUP_CODE \
-  setbuf(stdin,0); \
-   setbuf(stdout,0);
-
 #include <limits.h>
 #include <sys/stat.h>
 #define GET_FULL_PATH_SELF(a_) do {\
--- gcl-2.6.12.orig/h/mingw.h
+++ gcl-2.6.12/h/mingw.h
@@ -47,13 +47,6 @@
 #define DBEGIN_TY unsigned int
 extern DBEGIN_TY _stacktop, _stackbottom, _dbegin;
 
-/* define if there is no _cleanup,   do here what needs
-   to be done before calling unexec
-   */   
-#define CLEANUP_CODE \
-  setbuf(stdin,0); \
-  setbuf(stdout,0);
-
 #define NO_SYS_PARAM_H
 #define NO_SYS_TIMES_H
 
--- gcl-2.6.12.orig/o/alloc.c
+++ gcl-2.6.12/o/alloc.c
@@ -1796,6 +1796,10 @@ malloc(size_t size) {
 
   if (!gcl_alloc_initialized)
     gcl_init_alloc(&size);
+#ifdef CAN_UNRANDOMIZE_SBRK
+  else if (!gcl_unrandomized)
+    return sbrk(size);
+#endif
   
   CHECK_INTERRUPT;
   
--- gcl-2.6.12.orig/o/main.c
+++ gcl-2.6.12/o/main.c
@@ -412,16 +412,18 @@ DEFVAR("*CODE-BLOCK-RESERVE*",sSAcode_bl
 
 #define HAVE_GCL_CLEANUP
 
+#ifdef CAN_UNRANDOMIZE_SBRK
+bool gcl_unrandomized=FALSE;
+#endif
+
 void
 gcl_cleanup(int gc) {
 
   if (getenv("GCL_WAIT"))
     sleep(30);
   
-#ifdef CLEANUP_CODE
-  CLEANUP_CODE
-#elif defined(USE_CLEANUP)
-    {extern void _cleanup(void);_cleanup();}
+#if defined(USE_CLEANUP)
+  {extern void _cleanup(void);_cleanup();}
 #endif
 
 #ifdef GCL_GPROF
@@ -440,6 +442,10 @@ gcl_cleanup(int gc) {
     cs_org=0;
     initial_sbrk=core_end;
 
+#ifdef CAN_UNRANDOMIZE_SBRK
+    gcl_unrandomized=FALSE;
+#endif
+
   }
 
   close_pool();
@@ -450,6 +456,13 @@ gcl_cleanup(int gc) {
 int
 main(int argc, char **argv, char **envp) {
 
+#ifdef CAN_UNRANDOMIZE_SBRK
+#include <stdio.h>
+#include <stdlib.h>
+#include "unrandomize.h"
+  gcl_unrandomized=TRUE;
+#endif
+
   gcl_init_alloc(&argv);
 
 #ifdef GET_FULL_PATH_SELF
@@ -465,12 +478,6 @@ main(int argc, char **argv, char **envp)
 #endif	
   *argv=kcl_self;
   
-#ifdef CAN_UNRANDOMIZE_SBRK
-#include <stdio.h>
-#include <stdlib.h>
-#include "unrandomize.h"
-#endif
-  
   setbuf(stdin, stdin_buf); 
   setbuf(stdout, stdout_buf);
 #ifdef _WIN32