ignore ENOSYS error from mprotect in pthread_create and dynamic linker

this error simply indicated a system without memory protection (NOMMU)
and should not cause failure in the caller.
This commit is contained in:
Rich Felker
2015-06-17 17:21:46 +00:00
parent 10d0268ccf
commit 75eceb3ae8
2 changed files with 6 additions and 3 deletions
+2 -1
View File
@@ -232,7 +232,8 @@ int __pthread_create(pthread_t *restrict res, const pthread_attr_t *restrict att
if (guard) {
map = __mmap(0, size, PROT_NONE, MAP_PRIVATE|MAP_ANON, -1, 0);
if (map == MAP_FAILED) goto fail;
if (__mprotect(map+guard, size-guard, PROT_READ|PROT_WRITE)) {
if (__mprotect(map+guard, size-guard, PROT_READ|PROT_WRITE)
&& errno != ENOSYS) {
__munmap(map, size);
goto fail;
}