385abae
Description: <short summary of the patch>
385abae
 TODO: Put a short summary on the line above and replace this paragraph
385abae
 with a longer explanation of this change. Complete the meta-information
385abae
 with other relevant fields (see below for details). To make it easier, the
385abae
 information below has been extracted from the changelog. Adjust it or drop
385abae
 it.
385abae
 .
385abae
 gcl (2.6.12-21) unstable; urgency=medium
385abae
 .
385abae
   * Version_2_6_13pre26
385abae
Author: Camm Maguire <camm@debian.org>
385abae
385abae
---
385abae
The information above should follow the Patch Tagging Guidelines, please
385abae
checkout http://dep.debian.net/deps/dep3/ to learn about the format. Here
385abae
are templates for supplementary fields that you might want to add:
385abae
385abae
Origin: <vendor|upstream|other>, <url of original patch>
385abae
Bug: <url in upstream bugtracker>
385abae
Bug-Debian: https://bugs.debian.org/<bugnumber>
385abae
Bug-Ubuntu: https://launchpad.net/bugs/<bugnumber>
385abae
Forwarded: <no|not-needed|url proving that it has been forwarded>
385abae
Reviewed-By: <name and email of someone who approved the patch>
385abae
Last-Update: <YYYY-MM-DD>
385abae
385abae
--- gcl-2.6.12.orig/h/att_ext.h
385abae
+++ gcl-2.6.12/h/att_ext.h
385abae
@@ -217,6 +217,10 @@ frame_ptr frs_sch_catch();
385abae
 /*  gbc.c  */
385abae
 EXTER bool GBC_enable;
385abae
 
385abae
+#ifdef CAN_UNRANDOMIZE_SBRK
385abae
+EXTER bool gcl_unrandomized;
385abae
+#endif
385abae
+
385abae
 /*  let.c  */
385abae
 
385abae
 /*  lex.c  */
385abae
--- gcl-2.6.12.orig/h/gnuwin95.h
385abae
+++ gcl-2.6.12/h/gnuwin95.h
385abae
@@ -7,15 +7,6 @@
385abae
 #define DBEGIN_TY unsigned long
385abae
 extern DBEGIN_TY _dbegin;
385abae
 
385abae
-
385abae
-
385abae
-/* define if there is no _cleanup,   do here what needs
385abae
-   to be done before calling unexec
385abae
-   */   
385abae
-#define CLEANUP_CODE \
385abae
-  setbuf(stdin,0); \
385abae
-   setbuf(stdout,0);
385abae
-
385abae
 /* size to use for mallocs done  */
385abae
 /* #define BABY_MALLOC_SIZE 0x5000 */
385abae
 
385abae
--- gcl-2.6.12.orig/h/linux.h
385abae
+++ gcl-2.6.12/h/linux.h
385abae
@@ -130,10 +130,6 @@ do { int c = 0; \
385abae
 
385abae
 #define SET_SESSION_ID() (setpgrp() ? -1 : 0)
385abae
 
385abae
-#define CLEANUP_CODE \
385abae
-  setbuf(stdin,0); \
385abae
-   setbuf(stdout,0);
385abae
-
385abae
 #include <limits.h>
385abae
 #include <sys/stat.h>
385abae
 #define GET_FULL_PATH_SELF(a_) do {\
385abae
--- gcl-2.6.12.orig/h/mingw.h
385abae
+++ gcl-2.6.12/h/mingw.h
385abae
@@ -47,13 +47,6 @@
385abae
 #define DBEGIN_TY unsigned int
385abae
 extern DBEGIN_TY _stacktop, _stackbottom, _dbegin;
385abae
 
385abae
-/* define if there is no _cleanup,   do here what needs
385abae
-   to be done before calling unexec
385abae
-   */   
385abae
-#define CLEANUP_CODE \
385abae
-  setbuf(stdin,0); \
385abae
-  setbuf(stdout,0);
385abae
-
385abae
 #define NO_SYS_PARAM_H
385abae
 #define NO_SYS_TIMES_H
385abae
 
385abae
--- gcl-2.6.12.orig/o/alloc.c
385abae
+++ gcl-2.6.12/o/alloc.c
385abae
@@ -1796,6 +1796,10 @@ malloc(size_t size) {
385abae
 
385abae
   if (!gcl_alloc_initialized)
385abae
     gcl_init_alloc(&size);
385abae
+#ifdef CAN_UNRANDOMIZE_SBRK
385abae
+  else if (!gcl_unrandomized)
385abae
+    return sbrk(size);
385abae
+#endif
385abae
   
385abae
   CHECK_INTERRUPT;
385abae
   
385abae
--- gcl-2.6.12.orig/o/main.c
385abae
+++ gcl-2.6.12/o/main.c
385abae
@@ -412,16 +412,18 @@ DEFVAR("*CODE-BLOCK-RESERVE*",sSAcode_bl
385abae
 
385abae
 #define HAVE_GCL_CLEANUP
385abae
 
385abae
+#ifdef CAN_UNRANDOMIZE_SBRK
385abae
+bool gcl_unrandomized=FALSE;
385abae
+#endif
385abae
+
385abae
 void
385abae
 gcl_cleanup(int gc) {
385abae
 
385abae
   if (getenv("GCL_WAIT"))
385abae
     sleep(30);
385abae
   
385abae
-#ifdef CLEANUP_CODE
385abae
-  CLEANUP_CODE
385abae
-#elif defined(USE_CLEANUP)
385abae
-    {extern void _cleanup(void);_cleanup();}
385abae
+#if defined(USE_CLEANUP)
385abae
+  {extern void _cleanup(void);_cleanup();}
385abae
 #endif
385abae
 
385abae
 #ifdef GCL_GPROF
385abae
@@ -440,6 +442,10 @@ gcl_cleanup(int gc) {
385abae
     cs_org=0;
385abae
     initial_sbrk=core_end;
385abae
 
385abae
+#ifdef CAN_UNRANDOMIZE_SBRK
385abae
+    gcl_unrandomized=FALSE;
385abae
+#endif
385abae
+
385abae
   }
385abae
 
385abae
   close_pool();
385abae
@@ -450,6 +456,13 @@ gcl_cleanup(int gc) {
385abae
 int
385abae
 main(int argc, char **argv, char **envp) {
385abae
 
385abae
+#ifdef CAN_UNRANDOMIZE_SBRK
385abae
+#include <stdio.h>
385abae
+#include <stdlib.h>
385abae
+#include "unrandomize.h"
385abae
+  gcl_unrandomized=TRUE;
385abae
+#endif
385abae
+
385abae
   gcl_init_alloc(&argv);
385abae
 
385abae
 #ifdef GET_FULL_PATH_SELF
385abae
@@ -465,12 +478,6 @@ main(int argc, char **argv, char **envp)
385abae
 #endif	
385abae
   *argv=kcl_self;
385abae
   
385abae
-#ifdef CAN_UNRANDOMIZE_SBRK
385abae
-#include <stdio.h>
385abae
-#include <stdlib.h>
385abae
-#include "unrandomize.h"
385abae
-#endif
385abae
-  
385abae
   setbuf(stdin, stdin_buf); 
385abae
   setbuf(stdout, stdout_buf);
385abae
 #ifdef _WIN32