diff --git a/alloc.c b/alloc.c index b02f13e..4dcdb0d 100644 --- a/src/alloc.c +++ b/src/alloc.c @@ -1345,6 +1345,7 @@ laligned (void *p, size_t size) static void * lmalloc (size_t size, bool clearit) { + clearit = true; #ifdef USE_ALIGNED_ALLOC if (! MALLOC_IS_LISP_ALIGNED && size % LISP_ALIGNMENT == 0) { @@ -1375,11 +1376,15 @@ lmalloc (size_t size, bool clearit) static void * lrealloc (void *p, size_t size) { + int oldsize = malloc_usable_size(p); while (true) { p = realloc (p, size); - if (laligned (p, size) && (size || p)) + if (laligned (p, size) && (size || p)) { + if (size > oldsize) + memset(p+oldsize, 0, size-oldsize); return p; + } size_t bigger = size + LISP_ALIGNMENT; if (size < bigger) size = bigger; @@ -7452,7 +7457,7 @@ respective remote host. */) struct sysinfo si; uintmax_t units; - if (sysinfo (&si)) + if (1) return Qnil; #ifdef LINUX_SYSINFO_UNIT units = si.mem_unit; diff --git a/fns.c b/fns.c index 0a90295..34f3d2d 100644 --- a/fns.c +++ b/src/fns.c @@ -86,11 +86,13 @@ With a string argument, set the seed based on the string's contents. See Info node `(elisp)Random Numbers' for more details. */) (Lisp_Object limit) { - if (EQ (limit, Qt)) + if (EQ (limit, Qt)) { init_random (); - else if (STRINGP (limit)) + seed_random("foo", 3); + } else if (STRINGP (limit)) { seed_random (SSDATA (limit), SBYTES (limit)); - else if (FIXNUMP (limit)) + seed_random("foo", 3); + } else if (FIXNUMP (limit)) { EMACS_INT lim = XFIXNUM (limit); if (lim <= 0) @@ -5720,7 +5722,7 @@ extract_data_from_object (Lisp_Object spec, char *lim = SSDATA (object) + start_hold; for (char *p = SSDATA (object); p < lim; p++) { - ssize_t gotten = getrandom (p, lim - p, 0); + ssize_t gotten = 1; memset(p,0,1);//getrandom (p, lim - p, 0); if (0 <= gotten) p += gotten; else if (errno != EINTR) diff --git a/sysdep.c b/sysdep.c index ef2dc12..d77de0e 100644 --- a/sysdep.c +++ b/src/sysdep.c @@ -2179,7 +2179,7 @@ init_random (void) success = w32_init_random (&v, sizeof v) == 0; #else verify (sizeof v <= 256); - success = getrandom (&v, sizeof v, 0) == sizeof v; + success = 1; //getrandom (&v, sizeof v, 0) == sizeof v; #endif /* If that didn't work, just use the current time value and PID. @@ -2190,6 +2190,7 @@ init_random (void) v = getpid () ^ t.tv_sec ^ t.tv_nsec; } + v=42; set_random_seed (v); }