Commit b312a492 authored by Paul Eggert's avatar Paul Eggert

* emacs.c: Integer overflow minor fix.

(heap_bss_diff): Now uprintmax_t, not unsigned long.  All used changed.
Define only if GNU_LINUX.
(main, Fdump_emacs): Set and use heap_bss_diff only if GNU_LINUX.
parent dfd153ae
2011-07-07 Paul Eggert <eggert@cs.ucla.edu>
* emacs.c: Integer overflow minor fix.
(heap_bss_diff): Now uprintmax_t, not unsigned long. All used changed.
Define only if GNU_LINUX.
(main, Fdump_emacs): Set and use heap_bss_diff only if GNU_LINUX.
* dispnew.c: Integer signedness and overflow fixes.
Remove unnecessary forward decls, that were a maintenance hassle.
(history_tick): Now uprintmax_t, so it's more likely to avoid overflow.
......
......@@ -166,8 +166,10 @@ char *stack_bottom;
/* The address where the heap starts (from the first sbrk (0) call). */
static void *my_heap_start;
#ifdef GNU_LINUX
/* The gap between BSS end and heap start as far as we can tell. */
static unsigned long heap_bss_diff;
static uprintmax_t heap_bss_diff;
#endif
/* Nonzero means running Emacs without interactive terminal. */
int noninteractive;
......@@ -713,6 +715,7 @@ main (int argc, char **argv)
setenv ("G_SLICE", "always-malloc", 1);
#endif
#ifdef GNU_LINUX
if (!initialized)
{
extern char my_endbss[];
......@@ -723,6 +726,7 @@ main (int argc, char **argv)
heap_bss_diff = (char *)my_heap_start - max (my_endbss, my_endbss_static);
}
#endif
#ifdef RUN_TIME_REMAP
if (initialized)
......@@ -2131,7 +2135,7 @@ You must run Emacs in batch mode in order to dump it. */)
{
fprintf (stderr, "**************************************************\n");
fprintf (stderr, "Warning: Your system has a gap between BSS and the\n");
fprintf (stderr, "heap (%lu bytes). This usually means that exec-shield\n",
fprintf (stderr, "heap (%"pMu" bytes). This usually means that exec-shield\n",
heap_bss_diff);
fprintf (stderr, "or something similar is in effect. The dump may\n");
fprintf (stderr, "fail because of this. See the section about\n");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment