[CRIU] [PATCH 3/3] check: Call sbrk to get current brk

Pavel Emelyanov xemul at virtuozzo.com
Mon Mar 14 01:32:55 PDT 2016


According to man, glibc brk reports 0 on success, but we need current brk

Signed-off-by: Pavel Emelyanov <xemul at virtuozzo.com>
---
 criu/cr-check.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/criu/cr-check.c b/criu/cr-check.c
index c252537..10872d5 100644
--- a/criu/cr-check.c
+++ b/criu/cr-check.c
@@ -194,7 +194,7 @@ static int check_prctl(void)
 		} else
 			pr_warn("Skipping unssuported PR_SET_MM_MAP\n");
 
-		ret = prctl(PR_SET_MM, PR_SET_MM_BRK, brk(0), 0, 0);
+		ret = prctl(PR_SET_MM, PR_SET_MM_BRK, (unsigned long)sbrk(0), 0, 0);
 		if (ret) {
 			if (errno == EPERM)
 				pr_msg("prctl: One needs CAP_SYS_RESOURCE capability to perform testing\n");
-- 
2.1.4



More information about the CRIU mailing list