Skip to content
Snippets Groups Projects
Commit 160b4d95 authored by Christian Engwer's avatar Christian Engwer
Browse files

[debugallocator]

use mprotect only if the m4-test succeeded

[[Imported from SVN: r7016]]
parent b5256028
No related branches found
No related tags found
No related merge requests found
......@@ -5,13 +5,15 @@
#include <exception>
#include <typeinfo>
#include <sys/mman.h>
#include <vector>
#include <iostream>
#include <cstring>
#include <cstdlib>
#include <malloc.h>
#include <new>
#if HAVE_SYS_MMAN_H and HAVE_MPROTECT
#include <sys/mman.h>
#endif
#include "mallocallocator.hh"
......@@ -58,6 +60,7 @@ namespace Dune
private:
void memprotect(void* from, difference_type len, int prot)
{
#if HAVE_SYS_MMAN_H and HAVE_MPROTECT
int result = mprotect(from, len, prot);
if (result == -1)
{
......@@ -75,6 +78,9 @@ namespace Dune
<< std::endl;
abort();
}
#else
std::cerr << "WARNING: memory protection not available" << std::endl;
#endif
}
public:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment