[CRIU] [PATCH] aio: Fix mmap retval analysing

Kirill Tkhai ktkhai at virtuozzo.com
Fri May 13 03:45:36 PDT 2016


MAP_FAILED is retval of lib'c mmap(). Direct syscall
returns IS_ERR() in case of error.

Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
---
 criu/pie/restorer.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/criu/pie/restorer.c b/criu/pie/restorer.c
index c4fc1e5..9249b9d 100644
--- a/criu/pie/restorer.c
+++ b/criu/pie/restorer.c
@@ -624,7 +624,7 @@ static int restore_aio_ring(struct rst_aio_ring *raio)
 				MAP_PRIVATE|MAP_ANONYMOUS, -1, 0);
 	iocbp = (void *)iocb + sizeof(struct iocb);
 
-	if (iocb == MAP_FAILED) {
+	if (IS_ERR(iocb)) {
 		pr_err("Can't mmap aio tmp buffer\n");
 		return -1;
 	}



More information about the CRIU mailing list