<short summary of the patch>
authorCamm Maguire <camm@debian.org>
Thu, 11 Aug 2022 17:16:42 +0000 (18:16 +0100)
committerCamm Maguire <camm@debian.org>
Thu, 11 Aug 2022 17:16:42 +0000 (18:16 +0100)
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

Gbp-Pq: Name Version_2_6_13pre27

h/att_ext.h
h/gnuwin95.h
h/linux.h
h/mingw.h
o/alloc.c
o/main.c

index e241b7cd9259a1bdbb285056e6ebc77f2c2f1149..8c8f393bb236c64948a8ccc122658d727d6c607a 100755 (executable)
@@ -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  */
index 10d7514fd59d33ffa3d86d423499b2aefe6361ac..a4b9c71077741654fd3a8f92782bb2955e2887c0 100755 (executable)
@@ -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 */
 
index 169af5ef8a103f99040264621cb08bdbed7670e9..04f62b722d2dfc3442392a12f40029112412be2d 100644 (file)
--- a/h/linux.h
+++ b/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 {\
index e9ac9544b5126cb875f213d66a18fda484e588b3..065fdf44c61c1e4582f539507acf2292a98c58ac 100755 (executable)
--- a/h/mingw.h
+++ b/h/mingw.h
 #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
 
index 154043fee8fc47f6a655869376a49e28d3188414..daad17f0e2440d1efb583bc8c15911b49d82474c 100644 (file)
--- a/o/alloc.c
+++ b/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;
   
index 5cd142e71efb48b29e504880f81618c9f4ccaa08..dc10a68fb5e75dbce6b1d5a506c4d8a46358baa4 100755 (executable)
--- a/o/main.c
+++ b/o/main.c
@@ -412,16 +412,18 @@ DEFVAR("*CODE-BLOCK-RESERVE*",sSAcode_block_reserveA,SI,Cnil,"");
 
 #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