Fixed bug in userspace brk
[akaros.git] / tools / compilers / gcc-glibc / glibc-2.11.1-ros / sysdeps / ros / sbrk.c
index 64346cc..00ee990 100644 (file)
@@ -46,28 +46,18 @@ __internal_setbrk (uintptr_t addr)
     if(real_new_brk > BRK_END)
       return -1;
 
-       /* Set the new curbrk on success, return -1 o/w */
     if (mmap((void*)real_brk, real_new_brk-real_brk,
              PROT_READ | PROT_WRITE | PROT_EXEC,
-             MAP_FIXED | MAP_ANONYMOUS, -1, 0) == (void*)real_brk) {
-               curbrk = real_new_brk;
-               return 0;
-       } else {
-               return -1;
-       }
+             MAP_FIXED | MAP_ANONYMOUS, -1, 0) != (void*)real_brk)
+      return -1;
   }
   else if(real_new_brk < real_brk)
   {
     if(real_new_brk < (uintptr_t)__procinfo.heap_bottom)
       return -1;
 
-       /* Set the new curbrk on success, return -1 o/w */
-    if (!munmap((void*)real_new_brk, real_brk - real_new_brk)) {
-               curbrk = real_new_brk;
-               return 0;
-       } else {
-               return -1;
-       }
+    if (!munmap((void*)real_new_brk, real_brk - real_new_brk))
+      return -1;
   }
 
   curbrk = addr;