diff options
author | David Phillips <dbphillipsnz@gmail.com> | 2016-05-11 18:36:37 +1200 |
---|---|---|
committer | David Phillips <dbphillipsnz@gmail.com> | 2016-05-11 18:36:37 +1200 |
commit | 7ee8c21b9eaa4f6981cf727729c415b4a5c310f3 (patch) | |
tree | 088ae6bed2901c05eca380936176f7192eb4530d | |
parent | bd9e975a30d3d5c761f77c0b0115b0a5accb59ce (diff) | |
download | fractal-gen-7ee8c21b9eaa4f6981cf727729c415b4a5c310f3.tar.xz |
Catch mmap error
-rw-r--r-- | fractal-gen.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/fractal-gen.c b/fractal-gen.c index 30f405b..38e2a08 100644 --- a/fractal-gen.c +++ b/fractal-gen.c @@ -80,13 +80,12 @@ int main(int argc, char **argv) } /* Allocate memory for sections */ -/* if ((sections = malloc(sizeof(data_section)*cores)) == NULL)*/ - sections = mmap(NULL, sizeof(data_section)*cores, PROT_READ|PROT_WRITE, - MAP_SHARED|MAP_ANONYMOUS, -1, 0); -/* { + if ((sections = mmap(NULL, sizeof(data_section)*cores, PROT_READ|PROT_WRITE, + MAP_SHARED|MAP_ANONYMOUS, -1, 0)) == (data_section*)MAP_FAILED) + { perror("mmap"); return 1; - }*/ + } ram_nice = (size*size)/clust_total; if (ram_nice < 1024) |