Commit cf6ce9a1 authored by Paul Eggert's avatar Paul Eggert
Browse files

Port dumping better to WSL

Problem reported by Angelo Graziosi in:
http://lists.gnu.org/archive/html/emacs-devel/2016-12/msg00822.html
* src/sysdep.c (disable_address_randomization):
Detect buggy platforms where 'personality' always returns 0.
parent 8661313e
...@@ -144,11 +144,16 @@ static const int baud_convert[] = ...@@ -144,11 +144,16 @@ static const int baud_convert[] =
bool bool
disable_address_randomization (void) disable_address_randomization (void)
{ {
bool disabled = false;
int pers = personality (0xffffffff); int pers = personality (0xffffffff);
disabled = (! (pers & ADDR_NO_RANDOMIZE) if (pers < 0)
&& 0 <= personality (pers | ADDR_NO_RANDOMIZE)); return false;
return disabled; int desired_pers = pers | ADDR_NO_RANDOMIZE;
/* Call 'personality' twice, to detect buggy platforms like WSL
where 'personality' always returns 0. */
return (pers != desired_pers
&& personality (desired_pers) == pers
&& personality (0xffffffff) == desired_pers);
} }
#endif #endif
......
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