about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/linux/sbrk.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/linux/sbrk.c b/src/linux/sbrk.c
index 36437653..1e82d643 100644
--- a/src/linux/sbrk.c
+++ b/src/linux/sbrk.c
@@ -1,9 +1,9 @@
 #include <stdint.h>
+#include <errno.h>
 #include "syscall.h"
 
 void *sbrk(intptr_t inc)
 {
-	unsigned long cur = syscall(SYS_brk, 0);
-	if (inc && syscall(SYS_brk, cur+inc) != cur+inc) return (void *)-1;
-	return (void *)cur;
+	if (inc) return (void *)__syscall_ret(-ENOMEM);
+	return (void *)__syscall(SYS_brk, 0);
 }