From: | "Magnus Granberg (zorry)" <zorry@g.o> |
---|---|
To: | gentoo-commits@l.g.o |
Subject: | [gentoo-commits] gentoo-x86 commit in dev-libs/libffi/files: libffi-3.0.13-emutramp_pax_proc.patch |
Date: | Sat, 18 May 2013 11:47:59 |
Message-Id: | 20130518114755.2A30220081@flycatcher.gentoo.org |
1 | zorry 13/05/18 11:47:55 |
2 | |
3 | Added: libffi-3.0.13-emutramp_pax_proc.patch |
4 | Log: |
5 | Add patch to use /proc for pax mark on libffi 3.0.13 #457194 |
6 | |
7 | Revision Changes Path |
8 | 1.1 dev-libs/libffi/files/libffi-3.0.13-emutramp_pax_proc.patch |
9 | |
10 | file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-libs/libffi/files/libffi-3.0.13-emutramp_pax_proc.patch?rev=1.1&view=markup |
11 | plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-libs/libffi/files/libffi-3.0.13-emutramp_pax_proc.patch?rev=1.1&content-type=text/plain |
12 | |
13 | Index: libffi-3.0.13-emutramp_pax_proc.patch |
14 | =================================================================== |
15 | --- a/src/closures.c 2013-03-17 23:27:11.000000000 +0100 |
16 | +++ b/src/closures.c 2013-04-29 23:26:02.279022022 +0200 |
17 | @@ -181,10 +181,26 @@ static int emutramp_enabled = -1; |
18 | static int |
19 | emutramp_enabled_check (void) |
20 | { |
21 | - if (getenv ("FFI_DISABLE_EMUTRAMP") == NULL) |
22 | - return 1; |
23 | - else |
24 | + char *buf = NULL; |
25 | + size_t len = 0; |
26 | + FILE *f; |
27 | + int ret; |
28 | + f = fopen ("/proc/self/status", "r"); |
29 | + if (f == NULL) |
30 | return 0; |
31 | + ret = 0; |
32 | + |
33 | + while (getline (&buf, &len, f) != -1) |
34 | + if (!strncmp (buf, "PaX:", 4)) |
35 | + { |
36 | + char emutramp; |
37 | + if (sscanf (buf, "%*s %*c%c", &emutramp) == 1) |
38 | + ret = (emutramp == 'E'); |
39 | + break; |
40 | + } |
41 | + free (buf); |
42 | + fclose (f); |
43 | + return ret; |
44 | } |
45 | |
46 | #define is_emutramp_enabled() (emutramp_enabled >= 0 ? emutramp_enabled \ |